/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --clr-bg:      #f5f2ed;
  --clr-ink:     #1a1814;
  --clr-ink-2:   #4a4640;
  --clr-muted:   #716b64; /* 4.71:1 on --clr-bg — keep ≥ 4.5:1 (WCAG AA) */
  --clr-rule:    #d4d0ca;
  --clr-success: #2d6a4f;
  --clr-error:   #7c2d12;

  /* sticker accents — all ≥ 4.5:1 on --clr-bg */
  --clr-accent-1: #157a43;
  --clr-accent-2: #6a44c9;
  --clr-accent-3: #b34d00;

  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-accent:  'Syne', 'Inter', system-ui, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --clr-bg:      #171512;
    --clr-ink:     #ece8e1;
    --clr-ink-2:   #b9b3aa;
    --clr-muted:   #857f76;
    --clr-rule:    #35322c;
    --clr-success: #82c9a4;
    --clr-error:   #e0876a;

    --clr-accent-1: #63d695;
    --clr-accent-2: #b7a5f7;
    --clr-accent-3: #f0a066;
  }
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}


body {
  background: var(--clr-bg);
  color: var(--clr-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* <main> participates in the grid without breaking cell placement */
.contents { display: contents; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 1px solid var(--clr-ink);
  outline-offset: 3px;
}

/* ── Page grid ──────────────────────────────────────────── */
/*
  Rows:  header (auto) | main (1fr) | footer (auto)
  Cols:  image (22vw) | info (1fr) | form (1.4fr)
*/
.grid {
  display: grid;
  grid-template-columns: 22vw 1fr 1.4fr;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh; /* tracks mobile browser chrome so nothing hides behind it */
  gap: 4px;
  background: var(--clr-ink);
  border: 4px solid var(--clr-ink);
}

/* ── Cells ──────────────────────────────────────────────── */
.cell {
  background: var(--clr-bg);
}

.cell--header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1.25rem, 2.5vh, 1.75rem) clamp(1.5rem, 4vw, 3.5rem);
  animation: fadeDown 0.6s ease-out both;
}

.cell--image {
  overflow: hidden;
  animation: imgReveal 0.9s cubic-bezier(0.77, 0, 0.18, 1) 0.25s both;
}

.cell--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(8%);
  transform: translate(var(--px, 0px), var(--py, 0px)) scale(var(--zoom, 1.04));
  transition: filter 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  animation: imgZoom 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.25s backwards;
}

.cell--image:hover img {
  --zoom: 1.08;
  filter: grayscale(0%);
}

@keyframes imgReveal {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

@keyframes imgZoom {
  from { transform: scale(1.14); }
}

.cell--left {
  padding: clamp(1.5rem, 4vh, 3.75rem) clamp(1.5rem, 3.5vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(0.4rem, 1.2vh, 0.9rem);
}

.cell--right {
  padding: clamp(1.5rem, 4vh, 3.75rem) clamp(1.25rem, 3.5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.cell--footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1.1rem, 2.5vh, 1.5rem) clamp(1.5rem, 4vw, 3.5rem);
}

.cell--footer > * {
  animation: riseIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 1s both;
}

/* ── Entrance choreography ──────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ─────────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clr-muted);
}

.status-pill::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clr-ink);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--clr-ink) 55%, transparent); }
  60%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--clr-ink) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--clr-ink) 0%, transparent); }
}

/* ── Botcheck (honeypot — must be invisible but not display:none) */
.botcheck {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ── Left panel ─────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-accent);
  font-size: clamp(1.5rem, 0.9rem + 3vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--clr-ink);
}

/* 3-column layout: the left column is ~1/3 of the leftover width, so
   scale the word to the column and forbid mid-word breaks between the
   per-letter spans ("PORTF/OLIO"). */
@media (min-width: 1024px) {
  .eyebrow {
    font-size: clamp(1.5rem, 0.4rem + 2.55vw, 3.4rem);
    white-space: nowrap;
  }
}

/* Delays are set via nth-child (not inline style attrs) so they
   work under the CSP, which disallows inline styles. */
.letter {
  display: inline-block;
  animation: letterIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 0.055s + 0.3s);
}

.letter:nth-child(2) { --i: 1; }
.letter:nth-child(3) { --i: 2; }
.letter:nth-child(4) { --i: 3; }
.letter:nth-child(5) { --i: 4; }
.letter:nth-child(6) { --i: 5; }
.letter:nth-child(7) { --i: 6; }
.letter:nth-child(8) { --i: 7; }
.letter:nth-child(9) { --i: 8; }

@keyframes letterIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rule-group {
  display: flex;
  gap: 0.6rem;
}

.rule-group span {
  display: block;
  height: 4px;
  background: var(--clr-ink);
  transform-origin: left;
  animation: growRule 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rule-group span:nth-child(1) { width: clamp(3.5rem, 6vw, 6rem); animation-delay: 0.5s; }
.rule-group span:nth-child(2) { width: clamp(1.5rem, 2.5vw, 2.5rem); animation-delay: 0.62s; }
.rule-group span:nth-child(3) { width: clamp(0.6rem, 1vw, 1rem); animation-delay: 0.74s; }

@keyframes growRule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.7rem + 1.8vw, 2.4rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

.role {
  font-size: clamp(1rem, 0.85rem + 0.3vw, 1.1rem);
  font-weight: 400;
  color: var(--clr-ink-2);
  line-height: 1.6;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
}

.deloitte-brand {
  font-family: 'Helvetica Neue', 'Arial', sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 1.3em;
  letter-spacing: -0.01em;
  color: var(--clr-ink);
}

.deloitte-dot {
  color: #86BC25;
}

.role-word {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15em;
  color: var(--clr-ink);
}

.role-word::after {
  content: '';
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 2px;
  background: var(--clr-ink);
  vertical-align: text-bottom;
  animation: caretBlink 1.1s steps(2, start) infinite;
}

@keyframes caretBlink {
  to { visibility: hidden; }
}

/* ── Stickers ───────────────────────────────────────────── */
.stickers {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.35rem, 0.3rem + 0.4vw, 0.55rem);
  margin-top: auto;
}

.sticker {
  font-family: var(--font-accent);
  font-size: clamp(1rem, 0.9rem + 0.15vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-bg);
  background: var(--accent, var(--clr-ink));
  padding: clamp(0.28rem, 0.2rem + 0.4vw, 0.4rem) clamp(0.5rem, 0.4rem + 0.5vw, 0.7rem);
  border: 1.5px solid transparent;
  border-radius: 999px;
  transform: rotate(var(--tilt, -2deg));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: stickerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  cursor: default;
}

.sticker:hover {
  transform: rotate(0deg) scale(1.1);
}

.sticker:nth-child(1) { --tilt: -3deg;   --accent: var(--clr-accent-1); animation-delay: 1s; }
.sticker:nth-child(2) { --tilt: 2deg;    --accent: var(--clr-accent-2); animation-delay: 1.12s; border-style: dashed; border-color: var(--clr-bg); }
.sticker:nth-child(3) { --tilt: -1.5deg; --accent: var(--clr-accent-3); animation-delay: 1.24s; }

@keyframes stickerPop {
  from { opacity: 0; transform: scale(0.4) rotate(var(--tilt, -2deg)); }
}

.meta-line {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--clr-muted);
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.72s both;
}

.sub {
  font-size: clamp(1rem, 0.9rem + 0.2vw, 1.1rem);
  font-weight: 300;
  color: var(--clr-muted);
  line-height: 1.7;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.78s both;
}

/* ── Mad libs form ──────────────────────────────────────── */
.madlibs-form {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 2.5rem);
}

.madlibs-text {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.74rem + 1.3vw, 1.9rem);
  font-weight: 400;
  line-height: 2.15;
  color: var(--clr-ink);
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.75s both;
}

.ml-input {
  display: inline;
  border: none;
  border-bottom: 1.5px solid var(--clr-rule);
  font-family: var(--font-display);
  font-size: inherit;
  font-weight: 400;
  font-style: italic;
  color: var(--clr-ink);
  outline: none;
  padding: 0 0.1em 0.05em;
  min-width: 4ch;
  /* underline "draws" in ink over the base rule on focus / once filled */
  background: linear-gradient(var(--clr-ink), var(--clr-ink)) no-repeat left calc(100% + 1.5px) / 0% 1.5px;
  transition: background-size 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ml-input::placeholder {
  color: var(--clr-muted);
  font-style: italic;
  opacity: 1; /* muted token alone meets contrast; extra transparency broke it */
}

.ml-input:focus-visible {
  outline: 1px solid var(--clr-ink);
  outline-offset: 3px;
}

.ml-input:focus,
.ml-input:not(:placeholder-shown) {
  background-size: 100% 1.5px;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.9s both;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 24px; /* WCAG 2.5.8 minimum target size */
  background: none;
  border: none;
  border-bottom: 1px solid var(--clr-ink);
  padding: 0 0 0.15rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-ink);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.submit-btn:hover { color: var(--clr-muted); border-color: var(--clr-muted); }
.submit-btn:hover svg { transform: translate(2px, -2px); }
.submit-btn svg { transition: transform 0.2s ease; }

/* ── Sending state ──────────────────────────────────────── */
.sending-label {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clr-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.is-sending .sending-label { opacity: 1; }

/* ── Sent: the sentence flies off like a paper plane ────── */
.form--sent {
  animation: flyAway 0.65s cubic-bezier(0.6, -0.2, 0.9, 0.5) forwards;
  pointer-events: none;
}

@keyframes flyAway {
  0%   { transform: none; opacity: 1; }
  20%  { transform: translate(-1.5rem, 0.75rem) rotate(-4deg); }  /* wind-up */
  100% { transform: translate(55vw, -45vh) rotate(12deg) scale(0.4); opacity: 0; }
}

.form--gone { display: none; }

.result--sent {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stamp {
  font-family: var(--font-accent);
  font-size: clamp(1rem, 0.9rem + 0.2vw, 1.1rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clr-success);
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  transform: rotate(-8deg);
  animation: stampIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s backwards;
}

/* thumps down like a rubber stamp */
@keyframes stampIn {
  from { opacity: 0; transform: rotate(6deg) scale(2.4); }
}

.sent-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 0.8rem + 1vw, 1.6rem);
  color: var(--clr-ink);
  min-height: 1.4em; /* holds the line while the typewriter runs */
}

.sent-type.typing::after {
  content: '';
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 2px;
  background: var(--clr-ink);
  vertical-align: text-bottom;
  animation: caretBlink 1.1s steps(2, start) infinite;
}

/* ── Direct email fallback ──────────────────────────────── */
.direct-email {
  margin-top: 1.5rem;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 1s both;
}

.direct-or {
  display: block;
  font-family: var(--font-accent);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: 0.3rem;
}

.direct-email a {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 0.85rem + 0.7vw, 1.25rem);
  font-weight: 400;
  color: var(--clr-ink);
  word-break: break-all;
  background: linear-gradient(var(--clr-ink), var(--clr-ink)) no-repeat left bottom / 0% 1px;
  transition: background-size 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.direct-email a:hover {
  background-size: 100% 1px;
}

/* ── Result ─────────────────────────────────────────────── */
.result {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--clr-rule);
  margin-top: 0.1rem;
  animation: fadeUp 0.3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result svg { flex-shrink: 0; margin-top: 0.1rem; }
.result--success { color: var(--clr-success); }
.result--error   { color: var(--clr-error); }

/* ── Footer ─────────────────────────────────────────────── */
.visitor-count.sticker {
  --tilt: 2deg;
  --accent: #b84040;
  animation-delay: 1.1s;
}

@media (prefers-color-scheme: dark) {
  .visitor-count.sticker { --accent: #e07070; }
}

.people-icon {
  vertical-align: middle;
  margin-right: 0.25em;
  margin-top: -0.1em;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  color: var(--clr-muted);
}

.footer-links a {
  display: flex;
  align-items: center;
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--clr-ink);
}

/* ── Dark-mode image treatment ──────────────────────────── */
@media (prefers-color-scheme: dark) {
  .cell--image img { filter: grayscale(8%) brightness(0.9); }
  .cell--image:hover img { filter: grayscale(0%) brightness(0.96); }
}

/* ── Short viewports: compress spacing so everything fits ─ */
@media (max-height: 640px) {
  .cell--left,
  .cell--right {
    padding: clamp(0.75rem, 2vh, 1.5rem) clamp(1.25rem, 3vw, 2.5rem);
  }
  .cell--left { gap: clamp(0.25rem, 0.8vh, 0.5rem); }
  .madlibs-form { gap: 1rem; }
  .madlibs-text { line-height: 1.75; }
}

/* Extreme cases (landscape phones): shed optional lines, shrink type */
@media (max-height: 460px) {
  .sub, .stickers, .meta-line, .direct-email { display: none; }
  .cell--header, .cell--footer { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .cell--left, .cell--right { padding: 0.6rem 1rem; }
  .cell--left { gap: 0.25rem; }
  .eyebrow { font-size: clamp(1rem, 3vw, 1.4rem); }
  .rule-group span { height: 2px; }
  .tagline { font-size: clamp(1rem, 2.5vw, 1.15rem); }
  .tagline br, .role br { display: none; }
  .madlibs-text { font-size: 1rem; line-height: 1.6; }
  .madlibs-form { gap: 0.6rem; }
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }

  .role-word::after { display: none; }
}

/* ── iPad (481px – 1023px): 2-column, image hidden ─────── */
/* iPad: info at top, image left / form right */
/*  Row 1: header (full width)
    Row 2: info text (full width)
    Row 3: image (left col) | form (right col)
    Row 4: footer (full width)                 */
/* ── Tablet + Phone (≤ 1023px) ──────────────────────────── */
/*  Row 1: header (full width)
    Row 2: info text (full width)
    Row 3: image (left col) | form (right col)
    Row 4: footer (full width)                  */
@media (max-width: 1023px) {
  .grid {
    grid-template-columns: 2fr 3fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .cell--header { grid-column: 1 / -1; grid-row: 1; }

  .cell--left {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: clamp(1rem, 3vw, 1.5rem) clamp(1.25rem, 4vw, 2rem);
    justify-content: flex-start;
  }

  .cell--image {
    grid-column: 1;
    grid-row: 3;
    height: auto;
  }
  .cell--image img {
    object-fit: cover;
    object-position: center top;
  }

  .cell--right {
    grid-column: 2;
    grid-row: 3;
    padding: clamp(1rem, 3vw, 1.5rem) clamp(0.85rem, 2.5vw, 1.5rem);
    justify-content: center;
  }

  .cell--footer {
    grid-column: 1 / -1;
    grid-row: 4;
    padding: 0.75rem clamp(1rem, 3vw, 1.5rem);
  }

  .sub { display: none; }
  .stickers { display: none; }
  .madlibs-form { gap: 0.85rem; }
  .ml-input { min-width: 4ch; }

  .visitor-count.sticker {
    --tilt: 0deg;
    font-size: 1rem;
    padding: 0.18rem 0.38rem;
    letter-spacing: 0.05em;
    transform: none;
    animation: riseIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 1s both;
  }
  .people-icon { width: 10px; height: 8px; }
}
