/* =========================================================
   Kreative Writes — site styles
   Palette: indigo ink, cool paper, marigold, teal
   Type: Bricolage Grotesque (display) + Literata (reading)
   ========================================================= */

:root {
  --ink: #15172e;
  --ink-soft: #464a6b;
  --indigo: #1e2350;
  --indigo-deep: #141838;
  --paper: #f6f7fb;
  --paper-2: #eceef6;
  --line: #d9dcea;
  --marigold: #f2a93b;
  --marigold-deep: #c9821a;
  --teal: #1f8a8a;
  --white: #ffffff;

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --read: "Literata", Georgia, "Times New Roman", serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.65rem;
  --step-3: 2.15rem;
  --step-4: clamp(2.4rem, 5.2vw, 3.9rem);

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-lg: 22px;
  --radius-sm: 8px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--read);
  font-size: var(--step-0);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

img, svg, video, iframe { max-width: 100%; display: block; }

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal); }

:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: var(--step-4); font-weight: 700; }
h2 { font-size: var(--step-3); font-weight: 650; }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; max-width: 68ch; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--marigold); color: var(--ink); padding: 8px 14px; z-index: 100; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand svg { width: 32px; height: 32px; flex: none; }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a { font-family: var(--display); font-size: 0.98rem; text-decoration: none; color: var(--ink-soft); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--marigold); text-decoration-thickness: 3px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; font-family: var(--display); font-size: 0.95rem; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  padding: 13px 22px; border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.btn-primary { background: var(--marigold); color: var(--ink); }
.btn-primary:hover { background: #f7b955; color: var(--ink); transform: translateY(-1px); }
.btn-ghost { border-color: currentColor; color: inherit; background: transparent; }
.btn-ghost:hover { color: inherit; background: rgba(255,255,255,.08); }
.nav .btn { padding: 9px 16px; color: var(--ink); }

/* ---------- Hero ---------- */
.hero { background: var(--indigo); color: #e9ebfa; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: clamp(56px, 9vw, 110px); }
.hero h1 { color: var(--white); max-width: 14ch; }
.hero .lede { font-size: var(--step-1); line-height: 1.55; color: #c9cdee; max-width: 46ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-proof { margin-top: 34px; font-family: var(--display); font-size: var(--step--1); color: #a9aed8; max-width: 52ch; }

/* The signature: a script turning into a video frame */
.frame {
  position: relative; aspect-ratio: 9 / 14; width: min(100%, 360px); margin-inline: auto;
  border-radius: 28px; background:
    radial-gradient(120% 80% at 20% 10%, #2d3577 0%, transparent 60%),
    radial-gradient(90% 70% at 90% 90%, rgba(242,169,59,.35) 0%, transparent 60%),
    var(--indigo-deep);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.6);
  overflow: hidden;
}
.frame-top { position: absolute; inset: 18px 18px auto 18px; display: flex; justify-content: space-between; font-family: var(--display); font-size: 0.8rem; color: #c9cdee; }
.rec { display: inline-flex; align-items: center; gap: 7px; }
.rec::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #ff5a5a; }
.frame-script {
  position: absolute; left: 18px; right: 18px; top: 64px;
  font-family: var(--read); font-size: 0.86rem; line-height: 1.55; color: #8e93c4;
}
.frame-script b { color: var(--marigold); font-weight: 600; font-family: var(--display); font-size: 0.75rem; display: block; margin-bottom: 4px; }
.frame-caption {
  position: absolute; left: 18px; right: 18px; bottom: 74px; min-height: 4.6em;
  font-family: var(--display); font-weight: 700; font-size: 1.32rem; line-height: 1.22; color: var(--white);
}
.frame-caption mark { background: var(--marigold); color: var(--ink); padding: 0 .18em; border-radius: 4px; }
.caret { display: inline-block; width: 3px; height: 1.05em; background: var(--marigold); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.frame-bar { position: absolute; left: 18px; right: 18px; bottom: 30px; height: 4px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.frame-bar span { display: block; height: 100%; width: 0; background: var(--marigold); transition: width 4.5s linear; }
.frame.is-playing .frame-bar span { width: 72%; }

/* ---------- Sections ---------- */
section { padding-block: clamp(64px, 9vw, 112px); }
.section-head { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 48px; align-items: end; margin-bottom: 44px; }
.section-head p { color: var(--ink-soft); margin: 0; }
.alt { background: var(--white); border-block: 1px solid var(--line); }

/* Services: an index, not a card grid */
.services { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.service { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr; gap: 20px 40px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.service h3 { margin: 0; font-size: var(--step-2); }
.service p { margin: 0; color: var(--ink-soft); }
.service ul { margin: 0; padding: 0; list-style: none; font-family: var(--display); font-size: 0.95rem; color: var(--ink); }
.service li { padding: 2px 0; }
.service li::before { content: "+ "; color: var(--teal); font-weight: 700; }

/* Flywheel (a real sequence, so numbered) */
.flow { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); }
.flow li { counter-increment: step; padding: 28px 26px 30px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.flow li:nth-child(3n) { border-right: 0; }
.flow li:nth-last-child(-n+3) { border-bottom: 0; }
.flow li::before { content: counter(step); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--indigo); color: var(--white); font-family: var(--display); font-weight: 700; margin-bottom: 14px; }
.flow h3 { margin-bottom: 6px; }
.flow p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

/* Work */
.work-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 22px; }
.work { grid-column: span 4; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.work.wide { grid-column: span 8; }
.work-thumb { aspect-ratio: 16 / 10; border-radius: var(--radius-lg); background: var(--indigo); position: relative; overflow: hidden; margin-bottom: 14px; }
.work.wide .work-thumb { aspect-ratio: 16 / 8.4; }
.work-thumb[data-tone="teal"] { background: var(--teal); }
.work-thumb[data-tone="marigold"] { background: var(--marigold); }
.work-thumb[data-tone="paper"] { background: var(--paper-2); }
.work-thumb .tag { position: absolute; left: 16px; top: 16px; background: rgba(255,255,255,.92); color: var(--ink); font-family: var(--display); font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; }
.work-thumb .big { position: absolute; left: 18px; right: 18px; bottom: 16px; font-family: var(--display); font-weight: 700; font-size: clamp(1.2rem, 2.4vw, 1.9rem); line-height: 1.1; color: var(--white); }
.work-thumb[data-tone="marigold"] .big, .work-thumb[data-tone="paper"] .big { color: var(--ink); }
.work h3 { margin: 0 0 4px; }
.work p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.work:hover h3 { text-decoration: underline; text-decoration-color: var(--marigold); text-decoration-thickness: 3px; }

/* Video facade */
.yt { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); overflow: hidden; background: var(--indigo-deep); cursor: pointer; border: 0; padding: 0; width: 100%; color: var(--white); }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.yt .play { position: absolute; inset: 0; display: grid; place-items: center; }
.yt .play span { width: 74px; height: 74px; border-radius: 50%; background: var(--marigold); display: grid; place-items: center; }
.yt .play svg { width: 26px; height: 26px; margin-left: 4px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-empty { display: grid; place-items: center; text-align: center; padding: 24px; font-family: var(--display); color: #c9cdee; }

/* FAQ */
.faq { border-top: 2px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; font-family: var(--display); font-weight: 600; font-size: var(--step-1); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.6rem; line-height: 1; color: var(--teal); transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-soft); padding-bottom: 12px; }

/* Newsletter + contact */
.signup { background: var(--teal); color: var(--white); border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px 48px; align-items: center; }
.signup h2 { color: var(--white); }
.signup p { color: #d6f0ef; margin: 0; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
input, textarea, select {
  font: inherit; font-family: var(--display); font-size: 1rem;
  width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); color: var(--ink);
}
.field-row input { flex: 1 1 220px; width: auto; }
textarea { min-height: 150px; resize: vertical; }
label { display: block; font-family: var(--display); font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-note { font-family: var(--display); font-size: 0.9rem; margin-top: 10px; min-height: 1.4em; }
.hp { position: absolute; left: -5000px; }

/* Article / prose pages */
.page-hero { background: var(--indigo); color: #e9ebfa; padding-block: clamp(48px, 7vw, 84px); }
.page-hero h1 { color: var(--white); max-width: 20ch; }
.page-hero p { color: #c9cdee; font-size: var(--step-1); max-width: 56ch; margin: 0; }
.prose { max-width: 70ch; }
.prose h2 { font-size: var(--step-2); margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.answer { background: var(--white); border-left: 5px solid var(--marigold); padding: 18px 22px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1.6em; }
.answer p { margin: 0; }
.meta { font-family: var(--display); font-size: 0.95rem; color: #a9aed8; margin-top: 14px; }
.post-list { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); }
.post-list li { padding: 26px 0; border-bottom: 1px solid var(--line); }
.post-list a { text-decoration: none; }
.post-list h2 { font-size: var(--step-2); margin-bottom: 6px; }
.post-list p { color: var(--ink-soft); margin: 0; }
table { border-collapse: collapse; width: 100%; font-family: var(--display); font-size: 0.95rem; margin: 0 0 1.6em; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--paper-2); }

/* ---------- Footer ---------- */
.site-footer { background: var(--indigo-deep); color: #a9aed8; padding-block: 56px 32px; font-family: var(--display); font-size: 0.95rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h2 { color: var(--white); font-size: 1rem; margin-bottom: 12px; }
.site-footer a { color: #d7daf5; text-decoration: none; }
.site-footer a:hover { color: var(--marigold); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.site-footer .brand { color: var(--white); margin-bottom: 12px; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.12); padding-top: 20px; margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero .wrap, .section-head, .signup { grid-template-columns: 1fr; }
  .frame { width: min(100%, 300px); }
  .service { grid-template-columns: 1fr; gap: 10px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow li:nth-child(3n) { border-right: 1px solid var(--line); }
  .flow li:nth-child(2n) { border-right: 0; }
  .flow li:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .flow li:nth-last-child(-n+2) { border-bottom: 0; }
  .work, .work.wide { grid-column: span 6; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px var(--gutter) 20px; background: var(--paper); border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 8px 0; font-size: 1.05rem; }
  .flow { grid-template-columns: 1fr; }
  .flow li { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .flow li:last-child { border-bottom: 0 !important; }
  .work, .work.wide { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .frame-bar span { transition: none; }
  .btn { transition: none; }
}
