/* ============================================================
   Jordan Bardach — personal site
   A quiet calling card. Light "warm paper" theme.

   To switch to a quiet dark theme, swap the four values in the
   :root block marked "THEME" (alternatives are noted inline).
   ============================================================ */

/* ---- Fonts (self-hosted) ----
   Served from /fonts so they load instantly and identically on every browser
   and visit — no Google round-trip, no swap/flash timing differences. Latin
   subset only (all this site needs). Fraunces and Inter are variable fonts, so
   one file covers the 400–500 weight range we use. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/fraunces.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/inter.woff2") format("woff2");
}
@font-face {
  font-family: "Herr Von Muellerhoff";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/herrvonmuellerhoff.woff2") format("woff2");
}

:root {
  /* THEME — crisp white (light) */
  --bg:      #FBFBF9;   /* dark alt: #17150F */
  --ink:     #141414;   /* dark alt: #EFE9DD */
  --muted:   #6B6B6B;   /* dark alt: #98907F */
  --accent:  #7E9B86;   /* a quiet sage; works in both themes */

  --measure: 34rem;            /* max line length for the statement */
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---- Layout: one calm screen ---- */
.page {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 60rem;
  margin: 0 auto;
}

/* ---- Wordmark / signature ---- */
.wordmark {
  /* placeholder script signature — swap for the real signature SVG later */
  line-height: 1;
}

.signature {
  display: inline-block;
  font-family: "Herr Von Muellerhoff", cursive;
  font-size: clamp(2.6rem, 6vw, 3.4rem);
  line-height: 1.1;
  color: var(--ink);
  /* breathing room on every side for the script's flourishes (J descender,
     h's upper swash); negative margins cancel it so position is unchanged */
  padding: 0.4em 0.7em 0.7em 0.4em;
  margin: -0.4em -0.7em -0.7em -0.4em;
  /* "ink" reveal (wipe left to right) lives in the entrance block below, so it
     only starts once fonts + the photo are ready. */
}

/* Both -webkit- and unprefixed: Safari only animates clip-path with the
   prefixed property, and only reliably when both ends are in the keyframes. */
@keyframes sign {
  from { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); }
  to   { -webkit-clip-path: inset(0 0 0 0);    clip-path: inset(0 0 0 0); }
}

/* ---- The card (vertically centered statement) ---- */
.card {
  align-self: center;
  max-width: var(--measure);
  padding: 2rem 0;
}

.statement {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 4.2vw, 2.5rem);
  line-height: 1.28;
  letter-spacing: -0.005em;
  margin: 0 0 1.5rem;
  text-wrap: balance;
  position: relative;
  z-index: 3;          /* keep the photo reveal above the bio */
}

/* ---- "O" photo reveal (kinetic typography on load) ---- */
.o-wrap {
  position: relative;
  display: inline;
}
.o-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Rest size = the "O". We animate width/height (not transform: scale) so the
     photo is always painted at its true pixel size — sharp, never upscaled —
     and translate(-50%,-54%) keeps it centered on the O at every size. */
  width: 0.74em;
  height: 0.74em;
  border-radius: 50%;
  background: url("jordan.jpg") center 22% / cover no-repeat;
  transform: translate(-50%, -54%);
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 8px 30px -8px rgba(0, 0, 0, 0.35);
  /* The reveal animation (base timing linear; each segment eases below) lives
     in the entrance block, gated on .ready so it never starts before decode. */
}
@keyframes oReveal {
  /* fade the small circle in */
  0%   { opacity: 0; width: 0.74em; height: 0.74em; animation-timing-function: ease-out; }
  7%   { opacity: 1; width: 0.74em; height: 0.74em; animation-timing-function: cubic-bezier(.65, 0, .35, 1); } /* OPEN: smooth ease-in-out, slower */
  44%  { opacity: 1; width: 4.4em;  height: 4.4em;  animation-timing-function: linear; }                       /* hold open */
  60%  { opacity: 1; width: 4.4em;  height: 4.4em;  animation-timing-function: cubic-bezier(.22, 1, .36, 1); } /* CLOSE: the curve that already felt right */
  92%  { opacity: 1; width: 0.74em; height: 0.74em; animation-timing-function: ease-in; }
  100% { opacity: 0; width: 0.74em; height: 0.74em; }
}

/* On narrow screens "Operator." wraps to the start of its line, so the "O"
   sits against the left padding. A photo centered on it would spill off the
   left edge — so here we anchor the reveal to the O's left edge and let it
   unfurl to the right, keeping it fully on screen. */
@media (max-width: 600px) {
  .o-photo {
    left: 0;
    transform: translate(0, -54%);
  }
}

.bio {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 2.5rem;
  max-width: 32rem;
  position: relative;
  z-index: 1;
}

.bio em { font-style: italic; }

/* ---- Contact line (calling card) ---- */
.contact {
  display: flex;
  gap: 2rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.contact a,
.contact-open {
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 0 0 2px;
  cursor: pointer;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.4s var(--ease), color 0.3s var(--ease);
}

.contact a:hover,
.contact a:focus-visible,
.contact-open:hover,
.contact-open:focus-visible {
  color: var(--accent);
  background-size: 100% 1.5px;
}

/* ---- Contact overlay ---- */
.contact-dialog {
  border: none;
  border-radius: 4px;
  padding: 2.5rem;
  width: min(28rem, calc(100vw - 2rem));
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35);
  position: relative;
}
.contact-dialog::backdrop {
  background: rgba(20, 20, 20, 0.45);
  backdrop-filter: blur(2px);
}

.dialog-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.4rem;
  margin: 0 0 1.75rem;
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.3s var(--ease);
}
.dialog-close:hover { color: var(--ink); }

/* honeypot — hidden from humans */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 45%, transparent);
  padding: 0.4rem 0;
  border-radius: 0;
  transition: border-color 0.3s var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 3.5rem;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.btn-send {
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.6rem;
  margin-top: 0.5rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), opacity 0.3s var(--ease);
}

.btn-send:hover { background: var(--accent); color: var(--ink); }
.btn-send:disabled { opacity: 0.5; cursor: default; }

.form-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1rem 0 0;
  min-height: 1.2em;
}
.form-status[data-state="error"] { color: #b3433a; }

/* ---- Footer ---- */
.foot {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* ---- Focus (accessibility) ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---- Entrance: one gentle fade-up, nothing more ----
   The text entrance is pure CSS so it plays immediately and smoothly on both
   browsers (no waiting on webfont-load detection, which Safari handles poorly).
   Only the "O" photo waits on JS: it animates once .photo-go is added — after
   the bio has settled and jordan.jpg has decoded — so it never starts its
   expand mid-decode and races to the end.
   No JS → text still animates (CSS), the photo simply stays hidden.
   Reduced motion → everything is just visible (block below). */
@media (prefers-reduced-motion: no-preference) {
  .signature {
    -webkit-clip-path: inset(0 100% 0 0);
    clip-path: inset(0 100% 0 0);
    animation: sign 1.9s var(--ease) 0.25s forwards;
  }
  .statement,
  .bio,
  .contact,
  .foot {
    opacity: 0;
    transform: translateY(10px);
    animation: rise 0.9s var(--ease) forwards;
  }
  .statement { animation-delay: 0.12s; }
  .bio       { animation-delay: 0.24s; }
  .contact   { animation-delay: 0.36s; }
  .foot      { animation-delay: 0.48s; }

  .photo-go .o-photo { animation: oReveal 3.6s linear forwards; }
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .statement,
  .bio,
  .contact,
  .foot {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .signature {
    animation: none;
    -webkit-clip-path: none;
    clip-path: none;
  }
  .o-photo { display: none; }
}
