/* =============================================================================
   James Farrelly - AI Consultant
   Warm & minimal. Cream paper, terracotta accent, generous whitespace,
   characterful type. Editorial calm with a bit of personality.
   ============================================================================= */

/* ---- Tokens -------------------------------------------------------------- */
:root {
  --paper:      #F4EDE1;   /* warm cream, main surface */
  --paper-2:    #EFE5D5;   /* slightly deeper band */
  --card:       #FBF7EF;   /* raised card */
  --ink:        #2A241E;   /* warm near-black */
  --ink-soft:   #574C3F;   /* body text */
  --muted:      #756A5D;   /* captions, meta - darkened for WCAG AA on --paper/--card */
  --line:       #E3D8C6;   /* warm hairline */
  --line-2:     #D8CBB5;

  --accent:     #BC5A34;   /* terracotta */
  --accent-deep:#9C4526;   /* darker terracotta for text on light */
  --accent-soft:#D98E68;   /* soft clay */
  --accent-tint:#EFE0D2;   /* washed terracotta fill */

  --display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --body:    "Hanken Grotesk", "Segoe UI", sans-serif;
  --serif:   "Fraunces", Georgia, serif;

  --gutter: clamp(1.25rem, 5vw, 6.5rem);
  --maxw: 1200px;
  --section-pad: clamp(4.5rem, 12vh, 9.5rem);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 0.61, 0.30, 1);
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.55vw + 0.9rem, 1.14rem);
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}
/* soft warm gradient wash so the paper has depth */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(70% 55% at 82% -5%, rgba(217,142,104,0.20), transparent 60%),
    radial-gradient(60% 50% at 0% 100%, rgba(188,90,52,0.08), transparent 55%),
    var(--paper);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; }
::selection { background: var(--accent); color: #fff; }

/* subtle paper grain */
.grain {
  position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  opacity: 0.4; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ---- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
main > section { padding-block: var(--section-pad); position: relative; }

.skip-link {
  position: fixed; top: -60px; left: 1rem; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 0.55rem 1rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}

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

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--body); font-weight: 600; font-size: 0.98rem;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.5rem; border-radius: 100px;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 26px -12px rgba(156,69,38,0.6); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: transparent; color: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.9rem; }
.btn-lg { padding: 1.1rem 2rem; font-size: clamp(1rem, 2.2vw, 1.5rem); border-radius: 100px; }

/* ---- Top bar ------------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled {
  background: rgba(244,237,225,0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom-color: var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin-inline: auto; padding: 1rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-dot { color: var(--accent); }
.topnav { display: flex; gap: 1.9rem; }
.topnav a {
  font-size: 0.96rem; font-weight: 500; color: var(--ink-soft);
  position: relative; transition: color 0.2s var(--ease);
}
.topnav a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 100%; height: 1.5px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.topnav a:hover { color: var(--ink); }
.topnav a:hover::after, .topnav a.active::after { transform: scaleX(1); }
.topnav a.active { color: var(--ink); }
.topnav-cta { display: none; }
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 44px; height: 44px; padding: 0; margin: 0;
  background: transparent; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px; background: var(--ink);
  border-radius: 2px; transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-cta-desktop { display: none; }
  .nav-toggle { display: flex; }
  .topnav {
    display: flex; flex-direction: column; gap: 0; align-items: stretch;
    position: fixed; top: 0; right: 0; bottom: 0; width: min(80vw, 320px);
    background: var(--card); box-shadow: -20px 0 50px -20px rgba(60, 40, 20, 0.35);
    padding: 6rem 1.75rem 2rem; z-index: 150;
    transform: translateX(100%); transition: transform 0.35s var(--ease);
  }
  .topnav.is-open { transform: translateX(0); }
  .topnav a {
    padding: 0.9rem 0; font-size: 1.15rem; border-bottom: 1px solid var(--line);
  }
  .topnav a::after { display: none; }
  .topnav-cta {
    display: block; margin-top: 1.5rem; text-align: center; font-weight: 600;
    color: #fff; background: var(--ink); padding: 0.85rem 1.5rem; border-radius: 100px;
    border-bottom: none;
  }
  .nav-scrim {
    position: fixed; inset: 0; z-index: 140; background: rgba(42, 36, 30, 0.35);
    opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease);
  }
  .nav-scrim.is-open { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) { .topnav, .nav-toggle span { transition: none; } }

/* ---- Shared type --------------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.86rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-soft);
}
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.section-label {
  font-family: var(--body); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-deep);
  margin-bottom: 1.4rem;
}
.section-head { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.section-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.025em;
  max-width: 18ch;
}

/* =============================================================================
   HERO
   ============================================================================= */
.hero { padding-top: clamp(7rem, 16vh, 11rem); padding-bottom: clamp(3rem, 8vh, 6rem); }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3.4rem, 11vw, 8.2rem); line-height: 0.92; letter-spacing: -0.045em;
  margin: 1.3rem 0 1.6rem;
}
.hero-lead {
  font-size: clamp(1.15rem, 1.9vw, 1.55rem); line-height: 1.5; color: var(--ink-soft);
  max-width: 30ch;
}
.hero-lead em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--accent-deep); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.2rem; }
.hero-note {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-top: 2.4rem; font-size: 0.92rem; color: var(--muted); font-weight: 500;
}
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent);
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 70%,100% { transform: scale(2.8); opacity: 0; } }

.hero-visual { justify-self: end; width: 100%; }
.hero-visual-frame {
  position: relative;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 70px -34px rgba(120,70,40,0.5), 0 2px 0 rgba(255,255,255,0.45) inset;
  border: 1px solid rgba(255,255,255,0.45);
  aspect-ratio: 4 / 5;
  background:
    radial-gradient(125% 88% at 50% 122%, rgba(217,142,104,0.60), rgba(238,222,204,0.55) 44%, #F3ECDF 72%);
}
/* fine grain inside the portrait panel for warmth/depth */
.hero-visual-frame::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(80% 60% at 50% 8%, rgba(255,255,255,0.35), transparent 60%);
}
.hero-visual-frame img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 14px 26px rgba(120,70,40,0.20));
}
@media (max-width: 860px) {
  .hero { padding-top: clamp(5.5rem, 13vh, 8.5rem); text-align: center; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.7rem; justify-items: center; }
  .hero-visual { order: -1; width: 100%; max-width: 228px; justify-self: center; }
  .hero-visual-frame { aspect-ratio: 4 / 5; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-title { margin: 0.4rem 0 1.15rem; }
  .hero-lead { margin-inline: auto; }
  .hero-actions { justify-content: center; margin-top: 1.7rem; }
}

/* =============================================================================
   ABOUT
   ============================================================================= */
.about { background: var(--paper-2); border-block: 1px solid var(--line); position: relative; overflow: hidden; }
/* soft flowing "network" lines drifting in the right void */
.about::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  right: -6%; top: 50%; transform: translateY(-50%);
  width: min(40vw, 500px); aspect-ratio: 1;
  background: url("../assets/img/warm-lines.webp") center / contain no-repeat;
  mix-blend-mode: multiply; opacity: 0.6;
  -webkit-mask-image: radial-gradient(68% 68% at 50% 50%, #000 42%, transparent 78%);
  mask-image: radial-gradient(68% 68% at 50% 50%, #000 42%, transparent 78%);
}
@media (max-width: 900px) { .about::after { opacity: 0.22; right: -20%; } }
.about .container { position: relative; z-index: 1; }
.about-grid { display: grid; grid-template-columns: 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 900px) { .about-grid { grid-template-columns: 12rem 1fr; } }
.about .section-label { margin: 0; }
.statement {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.7rem, 3.9vw, 3rem); line-height: 1.16; letter-spacing: -0.02em;
  max-width: 20ch; margin-bottom: clamp(2rem, 5vh, 3.2rem);
}
.statement em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent-deep); }
.about-cols { display: grid; gap: 1.5rem; max-width: 62ch; }
.about-cols p { color: var(--ink-soft); }
@media (min-width: 640px) { .about-cols { grid-template-columns: 1fr 1fr; gap: 2.4rem; } }

/* =============================================================================
   SELECTED WORK
   ============================================================================= */
.projects { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.project {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 0.5rem 2rem;
  padding: clamp(1.6rem, 3.5vh, 2.6rem) 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
  transition: background 0.3s var(--ease);
}
.p-num {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.5rem; color: var(--accent); line-height: 1;
  padding-top: 0.15rem;
}
.p-main { min-width: 0; }
.p-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.3rem, 2.7vw, 1.95rem); line-height: 1.12; letter-spacing: -0.02em;
  transition: color 0.25s var(--ease);
}
.p-desc { color: var(--ink-soft); margin-top: 0.7rem; max-width: 60ch; font-size: 1.02rem; }
.p-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.p-tags li {
  font-size: 0.78rem; font-weight: 500; color: var(--ink-soft);
  padding: 0.28rem 0.7rem; border: 1px solid var(--line-2); border-radius: 100px;
  background: rgba(255,255,255,0.35);
}
.p-metric {
  justify-self: end; text-align: right; white-space: nowrap;
  font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--accent-deep);
  padding-top: 0.2rem;
}
.p-metric-hi { color: #fff; background: var(--accent); padding: 0.35rem 0.8rem; border-radius: 100px; font-size: 0.9rem; }
.project:hover { background: linear-gradient(90deg, rgba(255,255,255,0.4), transparent 70%); }
.project:hover .p-title { color: var(--accent-deep); }
@media (max-width: 700px) {
  .project { grid-template-columns: 2.4rem 1fr; grid-template-areas: "num main" "num metric"; gap: 0.3rem 1rem; }
  .p-num { grid-area: num; font-size: 1.2rem; }
  .p-main { grid-area: main; }
  .p-metric { grid-area: metric; justify-self: start; text-align: left; margin-top: 1rem; }
}

/* =============================================================================
   IMPACT
   ============================================================================= */
.impact { background: var(--accent); color: var(--paper); }
.impact .section-label { color: rgba(255,247,239,0.88); }
.figures {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(2.5rem, 6vh, 4.5rem) clamp(2rem, 6vw, 5rem);
}
@media (min-width: 900px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figure { display: flex; flex-direction: column; gap: 1rem; }
.fig-num {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(3.6rem, 8vw, 6.2rem); line-height: 0.9; letter-spacing: -0.02em;
  color: #FFF7EF; font-variant-numeric: tabular-nums;
}
.fig-sup { font-size: 0.4em; vertical-align: super; color: #FFF7EF; font-style: italic; }
.fig-arrow { color: #FFF7EF; font-family: var(--body); font-size: 0.6em; padding: 0 0.06em; }
.fig-label {
  font-size: 0.95rem; line-height: 1.5; color: #FFFFFF;
  max-width: 22ch; padding-top: 1rem; border-top: 1px solid rgba(255,247,239,0.28);
}

/* =============================================================================
   CAPABILITIES
   ============================================================================= */
.caps { border-top: 1px solid var(--line); }
.cap {
  display: grid; grid-template-columns: 16rem 1fr; gap: 1rem 2.5rem;
  padding: clamp(1.4rem, 3vh, 2.1rem) 0; border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.cap dt {
  font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.01em;
}
.cap dd { color: var(--ink-soft); font-size: 1.05rem; }
@media (max-width: 700px) { .cap { grid-template-columns: 1fr; gap: 0.4rem; } }

/* =============================================================================
   APPROACH
   ============================================================================= */
.approach { background: var(--paper-2); border-block: 1px solid var(--line); }
.steps {
  list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 2.6rem); counter-reset: step;
}
.step { position: relative; padding-top: 2rem; border-top: 2px solid var(--line-2); }
.step::before {
  content: ""; position: absolute; top: -2px; left: 0; width: 34%; height: 2px;
  background: var(--accent);
}
.step-n {
  font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--accent);
}
.step-title {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.15rem, 2vw, 1.4rem);
  margin: 0.5rem 0 0.6rem; letter-spacing: -0.01em;
}
.step-body { color: var(--ink-soft); font-size: 1rem; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr 1fr; gap: 2rem 1.4rem; } }
@media (max-width: 460px) { .steps { grid-template-columns: 1fr; } }

/* =============================================================================
   RECOGNITION
   ============================================================================= */
.recognition-grid { display: grid; grid-template-columns: 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 900px) { .recognition-grid { grid-template-columns: 12rem 1fr; } }
.recognition .section-label { margin: 0; }
.creds { list-style: none; padding: 0; }
.cred {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1.5rem;
  padding: clamp(1.1rem, 2.6vh, 1.7rem) 0; border-bottom: 1px solid var(--line);
}
.cred:first-child { border-top: 1px solid var(--line); }
.cred-title {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  letter-spacing: -0.01em;
}
.cred-meta { color: var(--muted); font-size: 0.95rem; }

/* =============================================================================
   CONTACT
   ============================================================================= */
.contact { text-align: center; position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; z-index: 0; left: 50%; top: 50%;
  width: min(90vw, 720px); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(217,142,104,0.32), rgba(188,90,52,0.06) 45%, transparent 68%);
  filter: blur(10px); pointer-events: none;
}
.contact-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.contact .section-label { color: var(--accent-deep); }
.contact-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1.02; letter-spacing: -0.03em;
  max-width: 16ch; margin-bottom: 1.4rem;
}
.contact-title em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent-deep); }
.contact-sub { color: var(--ink-soft); max-width: 46ch; margin: 0 auto 2.6rem; font-size: 1.1rem; }
.contact-links {
  list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem 2rem;
  margin-top: 2.4rem; font-weight: 500; color: var(--ink-soft);
}
.contact-links a { transition: color 0.2s var(--ease); }
.contact-links a:hover { color: var(--accent-deep); }

/* ---- Footer -------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding-block: 2.2rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem; }
.footer-brand { font-family: var(--display); font-weight: 700; }
.footer-meta { color: var(--muted); font-size: 0.9rem; }
.footer-top { color: var(--ink-soft); font-size: 0.9rem; font-weight: 500; transition: color 0.2s var(--ease); }
.footer-top:hover { color: var(--accent-deep); }

/* =============================================================================
   Reveal
   ============================================================================= */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); transition-delay: var(--reveal-delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .grain, .pulse::after { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* =============================================================================
   Motion: scroll progress, custom cursor, hero name assemble
   ============================================================================= */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 120;
  transform: scaleX(0); transform-origin: left; pointer-events: none;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  will-change: transform;
}
.cursor-dot {
  position: fixed; top: 0; left: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 1.5px solid var(--accent); border-radius: 50%; z-index: 9999; pointer-events: none;
  opacity: 0; mix-blend-mode: multiply;
  transition: opacity .3s var(--ease), width .22s var(--ease), height .22s var(--ease), margin .22s var(--ease), background .22s var(--ease);
}
@media (hover: hover) and (pointer: fine) { .cursor-dot.on { opacity: 1; } }
@media (hover: none), (pointer: coarse) { .cursor-dot { display: none; } }
.cursor-dot.hovering { width: 52px; height: 52px; margin: -26px 0 0 -26px; background: var(--accent-tint); }

.hw { display: block; overflow: hidden; padding-bottom: 0.09em; margin-bottom: -0.05em; }
.hw > span { display: block; transform: translateY(116%); will-change: transform; }
body.loaded .hw > span { transform: translateY(0); transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1); }
body.loaded .hw:nth-child(1) > span { transition-delay: 0.12s; }
body.loaded .hw:nth-child(2) > span { transition-delay: 0.25s; }

/* =============================================================================
   ASK MY AI - chat
   ============================================================================= */
.ask-head { max-width: 60ch; margin-bottom: clamp(2rem, 4.5vh, 3.2rem); }
.ask-head .section-title { max-width: 22ch; }
.ask-head .section-title em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent-deep); }
.ask-sub { color: var(--ink-soft); margin-top: 1.1rem; font-size: 1.08rem; max-width: 54ch; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: relative; display: inline-block; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: ping 2.4s var(--ease) infinite; }

.chat {
  max-width: 760px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 26px 64px -36px rgba(120, 70, 40, 0.5);
  padding: clamp(0.9rem, 2.4vw, 1.5rem);
  display: flex; flex-direction: column; gap: 1rem;
}
.chat-window {
  min-height: 210px; max-height: 400px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.85rem;
  padding: 0.4rem 0.4rem 0.2rem;
}
.chat-window::-webkit-scrollbar { width: 7px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }

.msg { display: flex; gap: 0.6rem; max-width: 90%; min-width: 0; animation: msgIn 0.4s var(--ease) both; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-ai { align-self: flex-start; }
.msg-mark {
  flex: none; width: 28px; height: 28px; border-radius: 50%; margin-top: 3px;
  display: grid; place-items: center; font-size: 0.85rem;
  background: var(--accent-tint); color: var(--accent-deep);
}
.msg-bubble {
  padding: 0.72rem 1rem; border-radius: 16px; line-height: 1.5; font-size: 1rem;
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}
.msg-ai .msg-bubble { background: var(--paper-2); color: var(--ink); border-bottom-left-radius: 5px; }
.msg-user .msg-bubble { background: var(--ink); color: var(--paper); border-bottom-right-radius: 5px; }
.msg-bubble a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.msg-user .msg-bubble a { color: #fff; }
.msg-bubble.streaming::after { content: "▊"; color: var(--accent); margin-left: 1px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dots { display: inline-flex; gap: 5px; align-items: center; height: 1.4em; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.3s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.16s; }
.dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font-family: var(--body); font-size: 0.85rem; font-weight: 500; color: var(--accent-deep);
  background: transparent; border: 1px solid var(--line-2); border-radius: 100px;
  padding: 0.45rem 0.9rem; cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.chip:hover { border-color: var(--accent); background: var(--accent-tint); transform: translateY(-1px); }

.chat-input { display: flex; gap: 0.5rem; align-items: center; border-top: 1px solid var(--line); padding-top: 1rem; }
.chat-input input {
  flex: 1; min-width: 0; font-family: var(--body); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 100px;
  padding: 0.8rem 1.15rem; outline: none; transition: border-color 0.2s var(--ease);
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input input::placeholder { color: var(--muted); }
.chat-send {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--ink); color: var(--paper); display: grid; place-items: center;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.chat-send:hover { background: var(--accent); transform: translateY(-1px); }
.chat-note { font-size: 0.8rem; color: var(--muted); text-align: center; }

@media (max-width: 420px) {
  .chat { padding: 0.75rem; gap: 0.8rem; }
  .chat-window { min-height: 190px; padding: 0.3rem 0.2rem 0.1rem; }
  .msg { max-width: 94%; }
  .msg-bubble { padding: 0.6rem 0.85rem; font-size: 0.95rem; }
  .chat-suggest { gap: 0.4rem; }
  .chip { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hw > span { transform: none; }
  .scroll-progress, .cursor-dot { display: none; }
  .live-dot::after, .dots i, .msg, .msg-bubble.streaming::after { animation: none; }
}
