/* shared by the landing page and every generated page: the app's glass bubbles,
   glass cards with their sketches, and the tracked red caps of fraegile.com */

:root {
  --paper: #f3f1f0;
  --red-ink: #e3000b;
  --glass-hi: rgba(255, 255, 255, .62);
  --glass-lo: rgba(255, 255, 255, .14);
  --glass-line: rgba(23, 23, 23, .1);
  --glass-shadow: rgba(23, 23, 23, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1a19;
    --red-ink: #ff6b6f;
    --glass-hi: rgba(255, 255, 255, .1);
    --glass-lo: rgba(255, 255, 255, .02);
    --glass-line: rgba(236, 233, 229, .14);
    --glass-shadow: rgba(0, 0, 0, .3);
  }
}

/* soft red and blue light at the top of the page, behind the logo and the first lines */
.glow { position: absolute; top: 0; left: 0; right: 0; height: 900px; pointer-events: none; overflow: hidden; z-index: -1; }
.glow::before, .glow::after { content: ''; position: absolute; left: 50%; border-radius: 50%; filter: blur(48px); animation: glow-drift 26s ease-in-out infinite alternate; }
.glow::before { --w: clamp(340px, 54vmin, 600px); width: var(--w); height: var(--w); top: calc(var(--glow-y, 190px) - var(--w) / 2); margin-left: calc(var(--w) / -2 - 4vmin); background: rgba(221, 92, 108, .34); }
.glow::after { --w: clamp(240px, 36vmin, 420px); width: var(--w); height: var(--w); top: calc(var(--glow-y, 190px) + 60px); margin-left: calc(var(--w) / -2 + 18vmin); background: rgba(110, 140, 230, .2); animation-duration: 32s; animation-direction: alternate-reverse; }
@keyframes glow-drift { to { transform: translate(3vmin, -2vmin) scale(1.06); } }
@media (prefers-color-scheme: dark) { .glow::before { background: rgba(221, 92, 108, .2); } .glow::after { background: rgba(110, 140, 230, .14); } }

/* section labels like fraegile.com: small, red, widely tracked caps */
.caps, .journal h2, .app h2, .section, .related h2 {
  font-weight: 400 !important; font-size: 11px !important; letter-spacing: .32em !important;
  text-transform: uppercase; color: var(--red-ink) !important; text-align: center;
}
/* the thin red line that joins the sections on fraegile.com */
.thread { display: block; width: 1px; height: 56px; margin: 40px auto 28px; background: var(--red-ink); opacity: .55; }

/* ---------- topic bubbles ---------- */
.bubbles { --b: 96px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; max-width: 640px; margin: 36px auto 0; padding: 0; }
@media (max-width: 520px) { .bubbles { --b: 80px; gap: 4px 6px; } .bubble span { font-size: 10.5px; letter-spacing: 0; padding: 0 3px; } }
.bubble {
  position: relative; display: grid; place-items: center;
  width: calc(var(--b) * var(--s, 1)); aspect-ratio: 1; border-radius: 50%;
  text-decoration: none; color: inherit;
  background: radial-gradient(circle at 35% 35%, var(--glass-hi), color-mix(in srgb, var(--glass-hi) 60%, transparent) 30%, color-mix(in srgb, var(--glass-lo) 100%, transparent) 70%);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 0 15px rgba(23, 23, 23, .02), inset -3px -3px 10px rgba(23, 23, 23, .03), 0 4px 16px var(--glass-shadow);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: bubble-float 5s ease-in-out infinite;
  transition: transform .3s ease, box-shadow .3s ease;
}
.bubble::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: url(/assets/bubble-gloss.png) center / cover; opacity: .3; pointer-events: none; }
.bubble span { position: relative; font-size: clamp(11px, calc(var(--b) * .135), 13px); font-weight: 300; letter-spacing: .025em; opacity: .85; padding: 0 6px; text-align: center; line-height: 1.2; }
.bubble:nth-child(2n) { animation-delay: -1.7s; animation-duration: 6s; }
.bubble:nth-child(3n) { animation-delay: -3.1s; animation-duration: 5.6s; }
.bubble:hover { transform: scale(1.06); color: inherit; }
.bubble:hover span { color: var(--red-ink); opacity: 1; }
/* the first topic gets the red bubble from the centre of the app */
.bubble:first-child {
  background: radial-gradient(circle at 35% 35%, hsla(356, 97%, 44%, .5), hsla(356, 97%, 44%, .4) 30%, hsla(356, 97%, 44%, .3) 60%, hsla(356, 97%, 44%, .2));
  border-color: hsla(356, 97%, 44%, .3);
  box-shadow: inset 0 0 15px hsla(356, 97%, 44%, .2), 0 4px 16px hsla(356, 97%, 44%, .25);
}
.bubble:first-child::before { opacity: .2; }
.bubble:first-child:hover span { color: inherit; }
@keyframes bubble-float { 50% { translate: 1px -4px; } }
@media (prefers-reduced-motion: reduce) { .bubble, .glow::before, .glow::after { animation: none; } }

/* ---------- glass cards with a sketch on top ---------- */
.cards a {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 20% 0%, var(--glass-hi), var(--glass-lo) 70%) !important;
  border: 1px solid var(--glass-line) !important; border-radius: 28px !important;
  box-shadow: inset 0 0 15px rgba(23, 23, 23, .015), 0 4px 16px var(--glass-shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.cards a:hover { border-color: color-mix(in srgb, var(--red-ink) 45%, transparent) !important; }
.cards a:hover strong { color: var(--red-ink); }
.cards .kicker { text-transform: uppercase; letter-spacing: .2em !important; font-size: 10px !important; }
.sketch { display: block; width: calc(100% + 44px); max-width: none; margin: -22px -22px 16px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; mix-blend-mode: multiply; }
.hero-sketch { margin: 0 0 32px; }
.hero-sketch img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 28px; mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .sketch, .hero-sketch img { mix-blend-mode: normal; filter: invert(.88) hue-rotate(180deg); } }

/* ---------- page changes: a quick dissolve between pages of the site ---------- */
/* paper behind everything, so nothing white shows while pages swap */
html { background: var(--paper); }
@view-transition { navigation: auto; }
/* the old page stays put and the new one fades in over it – no dip in between */
::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: page-in .38s ease both; mix-blend-mode: normal; }
@keyframes page-in { from { opacity: 0; } }
/* the landing page's slow blur-in is for arriving from outside; inside the site the dissolve is enough */
.via-site main { animation: none !important; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ---------- newsletter: the form of fraegile.com, in its red ---------- */
.newsletter { max-width: 560px; margin: 0 auto 56px; padding: 0 0 8px; text-align: center; }
.newsletter h2 { margin: 0 0 22px; font-weight: 500; font-size: clamp(12px, 1.5vw, 15px); line-height: 1.9; letter-spacing: .32em; text-transform: uppercase; color: var(--red-ink); }
.newsletter h2 span { display: block; }
.newsletter form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.nl-row { display: flex; }
.nl-row input { flex: 1; min-width: 0; height: 64px; padding: 0 24px; border: 1px solid var(--red-ink); border-radius: 0; background: transparent; color: var(--red-ink); font: 300 16px Inter, system-ui, sans-serif; outline: none; transition: background-color .3s ease; }
.nl-row input::placeholder { color: var(--red-ink); opacity: 1; }
.nl-row input:focus { background: color-mix(in srgb, var(--red-ink) 4%, transparent); }
.nl-row button { position: relative; flex: none; width: 64px; height: 64px; border: 0; padding: 0; background: var(--red-ink); cursor: pointer; overflow: hidden; display: grid; place-items: center; }
.nl-row button span { grid-area: 1 / 1; display: grid; place-items: center; transition: transform .5s ease-out; }
.nl-row button span + span { transform: translateX(-220%); }
.nl-row button:hover span:first-child { transform: translateX(220%); }
.nl-row button:hover span + span { transform: translateX(0); }
.newsletter p { margin: 0; font-size: 12px; line-height: 18px; color: var(--red-ink); }
.newsletter p a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.shake { animation: nl-shake .5s ease; }
@keyframes nl-shake { 20% { translate: -6px; } 45% { translate: 4px; } 70% { translate: -2px; } }
.newsletter label { position: absolute; left: -9999px; }
