/* amitch.design — Coming Soon
   Desktop layout is measured from the 16:9 mockup and scales with --u
   (1/100 of the mockup width), so proportions hold on any screen. */

:root {
  --dark: #1E1D1C;
  --light: #E8E8E8;
  --bg: var(--dark);
  --fg: var(--light);
  --u: min(1vw, 1.7778vh);
  --pad: max(1.05 * var(--u), 12px);
  --font: "Helvetica Now Display", "Neue Haas Grotesk Display Pro", "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: var(--light);
  --fg: var(--dark);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  transition: background-color .6s ease, color .6s ease;
}
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }

/* ---------- Page + entrance fade ---------- */
.page {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  opacity: 0;
  filter: blur(6px);
  transform: scale(1.012);
  transition: opacity 1.6s cubic-bezier(.22,.61,.36,1), filter 1.6s cubic-bezier(.22,.61,.36,1), transform 1.8s cubic-bezier(.22,.61,.36,1);
}
.page.is-ready { opacity: 1; filter: none; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .page { filter: none; transform: none; transition: opacity .8s ease; }
}

/* ---------- Header ---------- */
.header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(var(--pad) * .9) var(--pad) 0;
  pointer-events: none;
}
.header > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: calc(1.25 * var(--u)); }
.logo {
  font-size: max(2.3 * var(--u), 18px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.theme-toggle {
  --tw: max(2.85 * var(--u), 30px);
  --th: calc(var(--tw) * .5);
  position: relative;
  width: var(--tw);
  height: var(--th);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--fg);
  cursor: pointer;
  transition: background-color .6s ease;
}
.theme-toggle__knob {
  position: absolute;
  top: 50%;
  left: calc(var(--tw) - var(--th) * .5);
  width: calc(var(--th) * .72);
  height: calc(var(--th) * .72);
  border-radius: 50%;
  background: var(--bg);
  transform: translate(-50%, -50%);
  transition: left .45s cubic-bezier(.65,0,.35,1), background-color .6s ease;
}
:root[data-theme="light"] .theme-toggle__knob { left: calc(var(--th) * .5); }
.theme-toggle:focus-visible, .cta:focus-visible, .social a:focus-visible, .logo:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

.clock {
  display: flex;
  gap: calc(1 * var(--u));
  font-size: max(.86 * var(--u), 11px);
  font-weight: 400;
  letter-spacing: .01em;
  opacity: .85;
  padding-top: calc(.15 * var(--u));
  font-variant-numeric: tabular-nums;
}

/* ---------- Keychain ---------- */
/* The box is the keychain's slot in the 1782×1002 mockup (x 415–1290, y 0–770).
   The 3D render draws on a full-viewport canvas and maps itself onto this box. */
.keychain {
  position: absolute;
  z-index: 1;
  /* sits on the hero like in the mockup: on screens taller than 16:9 the extra height goes above it */
  top: max(0px, calc(100vh - 56.25 * var(--u)));
  top: max(0px, calc(100svh - 56.25 * var(--u)));
  left: calc(50% - 26.712 * var(--u));
  width: calc(49.102 * var(--u));
  aspect-ratio: 875 / 770;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.keychain__poster {
  /* rendered with a margin around the box so nothing is cut: 150% wide, 125% tall */
  position: absolute;
  left: -25%;
  top: 0;
  width: 150%;
  height: 125%;
  max-width: none;
  pointer-events: none;
}
/* the live render replaces the still in one frame, never cross-fading over it */
html.kc-live .keychain__poster { visibility: hidden; }
.keychain-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  visibility: hidden;
}
html.kc-live .keychain-canvas { visibility: visible; }

/* ?tune panel */
.kc-tune {
  position: fixed;
  z-index: 50;
  right: 12px;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  width: 250px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(20, 20, 20, .88);
  color: #eee;
  font: 12px/1.35 system-ui, sans-serif;
  backdrop-filter: blur(6px);
}
.kc-tune fieldset { border: 1px solid #444; border-radius: 6px; margin: 0 0 8px; padding: 6px 8px; }
.kc-tune legend { padding: 0 4px; font-weight: 600; }
.kc-tune label { display: grid; grid-template-columns: 14px 1fr 34px; align-items: center; gap: 6px; }
.kc-tune input[type=range] { width: 100%; }
.kc-tune button {
  margin: 4px 4px 0 0; padding: 5px 10px; border: 1px solid #666; border-radius: 6px;
  background: #2a2a2a; color: #eee; font: inherit; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: absolute;
  z-index: 2;
  inset: auto var(--pad) calc(4.1 * var(--u)) var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: calc(2 * var(--u));
}
.headline {
  margin: 0;
  font-size: calc(4.35 * var(--u));
  font-weight: 600;
  line-height: .93;
  letter-spacing: -0.035em;
}
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(37.4 * var(--u));
  height: calc(7.4 * var(--u));
  margin-bottom: calc(.6 * var(--u));
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: calc(4.3 * var(--u));
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  padding-bottom: .04em;
  box-shadow: inset 0 0 0 1px var(--fg);
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease;
}
/* Hover: outline only (thin border, transparent fill), no scaling */
@media (hover: hover) {
  .cta:hover { background-color: transparent; color: var(--fg); }
}

/* ---------- Footer ---------- */
.footer {
  position: absolute;
  z-index: 2;
  inset: auto var(--pad) calc(.85 * var(--u)) var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.copyright {
  margin: 0;
  font-size: max(.95 * var(--u), 11px);
  font-weight: 400;
  letter-spacing: -0.005em;
}
.social { display: flex; align-items: center; gap: calc(.95 * var(--u)); }
.social a { display: block; line-height: 0; transition: opacity .25s ease, transform .25s ease; }
.social a:hover { opacity: .7; transform: translateY(-2px); }
.social svg { width: max(2.05 * var(--u), 20px); height: max(2.05 * var(--u), 20px); }

/* =========================================================
   Mobile (portrait phones / narrow windows) — from the mobile mockup
   ========================================================= */
@media (max-width: 700px), (max-aspect-ratio: 4/5) {
  :root {
    /* the box is the design window; the whole keychain (a little wider than the box) fits across the screen */
    --kw: min(calc((100vw - 20px) * .807), 46svh);
    --kt: calc(30px + var(--kw) * .096); /* the top of the chain sits just under the logo row */
    --pad: 16px;
  }
  .header { padding: 12px 10px 0 10px; }
  .brand { width: 100%; justify-content: space-between; }
  .logo { font-size: min(5vw, 26px); }
  .theme-toggle { --tw: min(13vw, 56px); }
  .clock { display: none; }

  .keychain {
    top: var(--kt);
    width: var(--kw);
    left: calc(50% - var(--kw) * .567);
  }

  .hero {
    /* fills the space between the keychain and the footer, content sits in its upper-middle */
    inset: calc(var(--kt) + var(--kw) * .78 + 1svh) var(--pad) 56px var(--pad);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: max(0px, calc(100svh - var(--kt) - var(--kw) * .78 - 420px) * .45);
    gap: min(4.5svh, 9vw);
    text-align: center;
  }
  .headline { font-size: min(14.9vw, 8.4svh); line-height: .9; }
  .cta {
    width: auto;
    height: auto;
    margin: 0;
    padding: .42em 1.05em .46em;
    font-size: min(6.7vw, 3.8svh);
  }

  .footer { inset: auto 16px max(14px, env(safe-area-inset-bottom)) 16px; align-items: center; }
  .copyright { font-size: min(3.35vw, 14px); }
  .social { gap: 12px; }
  .social svg { width: min(5.8vw, 26px); height: min(5.8vw, 26px); }
}
