/* Svetlina website. One page, light and dark. The dark values are written twice:
   once for the system's dark mode (unless the visitor picked light) and once for a picked dark. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #1b1c1f;
  --ink-2: #575a61;
  --ink-3: #666a72;
  --hair: rgba(16, 22, 34, 0.15);
  --rim: rgba(16, 22, 34, 0.18);
  --rim-strong: rgba(16, 22, 34, 0.5);
  --cut: rgba(16, 22, 34, 0.45);
  --glow: 0;
  --stage: #f3f4f6;
  --stage-glow: 0;

  /* The shadow under the app's screenshots. */
  --shot-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.14), 0 30px 80px rgba(22, 28, 40, 0.28), 0 8px 24px rgba(22, 28, 40, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0b;
    --ink: #f5f5f3;
    --ink-2: #b3b5ba;
    --ink-3: #8e9095;
    --hair: rgba(255, 255, 255, 0.1);
    --rim: rgba(255, 255, 255, 0.22);
    --rim-strong: rgba(255, 255, 255, 0.6);
    --cut: rgba(0, 0, 0, 0.6);
    --glow: 0.13;
    --stage: #0a0a0b;
    --stage-glow: 1;
    --shot-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 40px 120px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --ink: #f5f5f3;
  --ink-2: #b3b5ba;
  --ink-3: #8e9095;
  --hair: rgba(255, 255, 255, 0.1);
  --rim: rgba(255, 255, 255, 0.22);
  --rim-strong: rgba(255, 255, 255, 0.6);
  --cut: rgba(0, 0, 0, 0.6);
  --glow: 0.13;
  --stage: #0a0a0b;
  --stage-glow: 1;
  --shot-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 40px 120px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page code {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.875em;
}

.count {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* Slides: a surface with one opening into the photograph. */

.slide {
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Let the soft glow fade out past the drawing's own edge; the slide still clips it.
     The photo is clipped to the opening, so nothing else can show at the edges. */
  overflow: visible;
}

.surface { fill: var(--bg); transition: fill 0.4s ease; }
.glow { fill: #ffffff; opacity: var(--glow); transition: opacity 0.5s ease; }
.rim { fill: none; stroke: var(--rim); stroke-width: 1; transition: stroke 0.3s ease; }
.cut { fill: none; stroke: var(--cut); }
.surface, .glow, .rim, .cut { pointer-events: none; }

/* The photo behind an opening fades in once it has loaded (main.js sets is-shown). */
.scene .photo { opacity: 0; transition: opacity 1.2s ease; }
.scene .photo.is-shown { opacity: 1; }

/* The first opening is a door: hovering or focusing it brightens the light and the edge. */
.enter { cursor: zoom-in; outline: none; }
.enter .hit { fill: transparent; }
.scene:has(.enter:hover) .glow, .scene:has(.enter:focus-visible) .glow { opacity: calc(var(--glow) * 1.9); }
.scene:has(.enter:hover) .rim, .scene:has(.enter:focus-visible) .rim { stroke: var(--rim-strong); }
.scene:has(.enter:focus-visible) .rim { stroke-width: 2; }
/* The text layer lies over the scene; let clicks through to the opening, except on its own controls. */
.slide-1 .wrap, .slide-2 .wrap { pointer-events: none; }
.slide-1 .wrap a, .slide-1 .wrap button, .slide-2 .wrap a { pointer-events: auto; }

.wrap {
  position: relative;
  height: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.75rem 2rem 3rem;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
}

.brand .mark { width: 28px; height: 28px; fill: var(--ink); transition: fill 0.4s ease; }
.brand span { font-weight: 500; font-size: 1.375rem; letter-spacing: -0.035em; }

.theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.theme-toggle:focus-visible, .brand:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[data-mode="dark"] .icon-sun { display: block; }
.theme-toggle[data-mode="dark"] .icon-moon { display: none; }

.hero-line {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}
.hero-line p {
  margin: 0;
  font-weight: 300;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.slide-2 .wrap { justify-content: center; padding-top: 6rem; }
.statement {
  margin: 0;
  font-weight: 600;
  font-size: clamp(3.5rem, 10vw, 9.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  max-width: 8ch;
}
.lede {
  margin: 2rem 0 0;
  font-weight: 300;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.45;
  max-width: 28rem;
  color: var(--ink-2);
}
.slide-2 .count { margin-top: 2.5rem; }

/* Slide 3: the app. */

.slide-3 {
  position: relative;
  background: var(--stage);
  transition: background-color 0.4s ease;
  overflow: hidden;
}
.slide-3::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 1200px;
  height: 700px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.1), transparent);
  opacity: var(--stage-glow);
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.slide-3 .wrap { align-items: center; gap: 2.5rem; padding: 4.5rem 2rem 4rem; }

.intro { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; }
.intro h2 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 34rem;
}

/* The real app, from an invented archive: the Mac's window, and the same page on the phone in front of
   its lower left corner, where it hides only the foot of the left panel. Light or dark as the site is. */

.devices { position: relative; width: min(990px, 100%); margin: 0 0 2rem; }
.devices img { display: block; width: 100%; height: auto; }
.mac { position: relative; container-type: inline-size; border-radius: 12px; overflow: hidden; box-shadow: var(--shot-shadow); }
/* The window's three buttons, which macOS draws and a screenshot of the app's page leaves out: where macOS
   puts them in a 1280 px wide window (12 px each, 8 px apart, 20 px in, centred in the 38 px bar). */
.lights { position: absolute; left: 1.5625cqw; top: 1.0156cqw; display: flex; gap: 0.625cqw; }
.lights i { width: 0.9375cqw; height: 0.9375cqw; border-radius: 50%; background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.phone {
  position: absolute;
  left: -3%;
  bottom: -9%;
  width: 19%;
  border: clamp(3px, 0.45vw, 6px) solid #101012;
  border-radius: clamp(16px, 2.6vw, 30px);
  overflow: hidden;
  background: #101012;
  box-shadow: var(--shot-shadow);
}
.phone img { border-radius: clamp(13px, 2.2vw, 25px); }

.shot-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot-light { display: none !important; }
  :root:not([data-theme="light"]) .shot-dark { display: block !important; }
}
:root[data-theme="dark"] .shot-light { display: none !important; }
:root[data-theme="dark"] .shot-dark { display: block !important; }

.status { display: flex; gap: 2.75rem; margin: 0; }
.status div { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.status dt { font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.status dd { margin: 0; font-weight: 500; font-size: 1.25rem; letter-spacing: -0.02em; }
.status dd a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--ink-3); }
.status dd a:hover { text-decoration-color: var(--ink); }
.status dd a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* The clearing: a full-screen layer that grows out of either opening (main.js animates it).
   A click anywhere shrinks it back, so the whole layer is the way out. */

html.in-clearing { overflow: hidden; }

.clearing {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #0a0a0b;
  outline: none;
  cursor: zoom-out;
}
.clearing[hidden] { display: none; }

.clearing-media {
  position: absolute;
  display: block;
  max-width: none;
  transform-origin: 0 0;
}
.clearing.is-open .clearing-media {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 62%);
}

.clearing-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0b;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.clearing-video.on { opacity: 1; }

/* Footer. */

.foot { border-top: 1px solid var(--hair); background: var(--stage); transition: background-color 0.4s ease; }
.foot-in {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.75rem 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.foot a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.foot a:hover { color: var(--ink); }

@media (max-width: 640px) {
  /* The scenes scale with the height; on a phone that makes the opening as wide as the screen.
     Give each scene only part of the height, so the opening stays a find in an empty surface. */
  .slide-1 .scene { top: 12%; height: 56%; }
  .slide-2 .scene { height: 42%; }
  .slide-2 .wrap { justify-content: flex-end; padding-top: 1.25rem; }
  .wrap { padding: 1.25rem 1.25rem 2.25rem; }
  .slide-3 .wrap { padding: 3.5rem 1.25rem 3rem; }
  .devices { margin-bottom: 3.5rem; }
  .phone { left: -1%; bottom: -16%; width: 30%; }
  .foot-in { padding: 1.5rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
