/* automation.nguyenlnp.com — "Night Shift" (sibling of ai.nguyenlnp.com) */
:root {
  --ground: #0e1420;
  --surface: #151d2c;
  --rule: #1f2a3d;
  --text: #eee8dc;
  --muted: #a7a08f;
  --lamp: #f2a65a;
  --lamp-ink: #1a1206;
  --ok: #34d399;

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --step-hero: clamp(2.9rem, 1.6rem + 5.6vw, 6rem);
  --step-h2: clamp(2rem, 1.3rem + 2.8vw, 3.6rem);
  --step-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);

  --gutter: clamp(1rem, 0.4rem + 3vw, 3.5rem);
  --section: clamp(4.5rem, 3rem + 6vw, 9rem);
  --measure: 62ch;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--step-body)/1.6 var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
/* fixed grain to match the illustration texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.035;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--lamp); }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 2px; }
.mono { font-family: var(--font-mono); font-size: 0.85em; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 60; background: var(--lamp); color: var(--lamp-ink); padding: 0.6rem 1rem; border-radius: 4px; }
.skip:focus { top: 1rem; }

/* ---------- header ---------- */
.site-head {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter);
}
.wordmark { font: 400 1.5rem/1 var(--font-display); text-decoration: none; color: #eee8dc; white-space: nowrap; }
.wordmark span { color: #f2a65a; font-style: italic; }
.site-nav { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 2rem); font-size: 0.95rem; }
.site-nav a { color: #eee8dc; text-decoration: none; }
.site-nav a:hover { color: #f2a65a; }
.site-nav .nav-link { display: none; }
@media (min-width: 760px) { .site-nav .nav-link { display: inline; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.4rem;
  border-radius: 4px;
  background: var(--lamp);
  color: var(--lamp-ink);
  font-weight: 600;
  text-decoration: none;
  transition: transform 200ms var(--ease-out-expo), background-color 200ms;
}
.btn:hover { color: var(--lamp-ink); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.site-head .btn { min-height: 44px; padding: 0 1rem; background: #f2a65a; color: #1a1206; font-size: 0.92rem; }
.text-link { font-weight: 500; }
.text-link::after { content: " →"; color: var(--lamp); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #eee8dc;
  background: #0e1420;
}
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 60%; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, #0e1420 2%, rgba(14, 20, 32, 0.55) 38%, rgba(14, 20, 32, 0) 70%),
    linear-gradient(to right, rgba(14, 20, 32, 0.6), rgba(14, 20, 32, 0) 60%);
}
.hero-copy { position: relative; z-index: 2; padding: 0 var(--gutter) clamp(3rem, 8vh, 6rem); max-width: 54rem; }
.hero h1 {
  margin: 0 0 1.25rem;
  font: 400 var(--step-hero)/0.95 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero h1 em { color: #f2a65a; }
.hero .lede { max-width: 40rem; margin: 0 0 2rem; color: #d9d2c4; font-size: clamp(1.05rem, 1rem + 0.35vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
.hero-actions .btn { background: #f2a65a; color: #1a1206; }
.hero-meta { margin-top: 2.25rem; color: #a7a08f; font-size: 0.9rem; }

/* ---------- sections ---------- */
.section { padding: var(--section) var(--gutter); border-top: 1px solid var(--rule); }
.section-head { display: grid; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3.5rem); max-width: 52rem; }
.kicker { margin: 0; color: var(--lamp); font-weight: 600; font-size: 0.95rem; }
.section h2 { margin: 0; font: 400 var(--step-h2)/1.02 var(--font-display); letter-spacing: -0.015em; text-wrap: balance; }
.section h2 em { color: var(--lamp); }
.section-head p { margin: 0; color: var(--muted); max-width: var(--measure); }
.split { display: grid; gap: clamp(2rem, 4vw, 4rem); align-items: start; }
@media (min-width: 960px) { .split { grid-template-columns: 1.05fr 1fr; } .split.flip > :first-child { order: 2; } }
.frame { margin: 0; }
.frame img { width: 100%; background: var(--surface); }
.frame figcaption { margin-top: 0.7rem; color: var(--muted); font-size: 0.85rem; }

/* ---------- the move back to Claude ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 2rem 1.75rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 0.55rem; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.timeline li.now::before { background: var(--lamp); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lamp) 25%, transparent); }
.timeline .when { display: block; color: var(--muted); }
.timeline h3 { margin: 0.15rem 0 0.4rem; font: 600 var(--step-h3)/1.25 var(--font-body); }
.timeline p { margin: 0; color: var(--muted); max-width: var(--measure); }

/* ---------- the rig ---------- */
.rig-list { display: grid; gap: 0; margin: 0; }
.rig-list > div { display: grid; gap: 0.35rem; padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.rig-list > div:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 720px) { .rig-list > div { grid-template-columns: 13rem 1fr; gap: 2rem; } }
.rig-list dt { font-weight: 600; }
.rig-list dd { margin: 0; color: var(--muted); }

/* ---------- dispatch board ---------- */
.board-shot { margin: 0; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: #e9edf2; }
.board-shot img { width: 100%; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.stats li { display: grid; }
.stats b { font: 400 clamp(2.2rem, 1.6rem + 2vw, 3.2rem)/1 var(--font-display); color: var(--text); }
.stats span { color: var(--muted); font-size: 0.92rem; }

/* ---------- services index ---------- */
.work-index { list-style: none; margin: 0; padding: 0; counter-reset: row; }
.work-index li {
  display: grid;
  gap: 0.5rem 2rem;
  padding: clamp(1.4rem, 2.5vw, 2rem) 0.5rem;
  border-top: 1px solid var(--rule);
  transition: background-color 200ms;
}
.work-index li:last-child { border-bottom: 1px solid var(--rule); }
.work-index li:hover { background: var(--surface); }
@media (min-width: 900px) { .work-index li { grid-template-columns: minmax(14rem, 1fr) 1.4fr 1.4fr; align-items: baseline; } }
.work-index h3 { margin: 0; font: 400 var(--step-h3)/1.2 var(--font-display); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.work-index p { margin: 0; color: var(--muted); }
.work-index .label { display: block; color: var(--text); font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; }

/* ---------- media studio ---------- */
.studio-grid { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
@media (min-width: 640px) { .studio-grid { grid-template-columns: repeat(2, 1fr); } }
.studio-grid h3 { margin: 0 0 0.5rem; font: 600 1.15rem/1.3 var(--font-body); }
.studio-grid p { margin: 0 0 0.75rem; color: var(--muted); }
.studio-grid .mono { color: var(--muted); display: block; line-height: 1.7; }
.note { margin-top: 2rem; color: var(--muted); font-size: 0.92rem; max-width: var(--measure); }

/* ---------- how a job runs ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; counter-reset: step; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(4, 1fr); gap: 2rem; } }
.steps li { counter-increment: step; padding-top: 1rem; border-top: 2px solid var(--rule); }
.steps li:last-child { border-top-color: var(--ok); }
.steps li::before { content: counter(step); display: block; font: 400 2rem/1 var(--font-display); color: var(--lamp); margin-bottom: 0.6rem; }
.steps h3 { margin: 0 0 0.35rem; font: 600 1.1rem/1.3 var(--font-body); }
.steps p { margin: 0; color: var(--muted); }

/* ---------- articles ---------- */
.guides { list-style: none; margin: 0; padding: 0; columns: 1; }
@media (min-width: 900px) { .guides { columns: 2; column-gap: 3rem; } }
.guides li { break-inside: avoid; padding: 0.9rem 0; border-top: 1px solid var(--rule); }
.guides a { text-decoration: none; font-weight: 500; }
.guides a:hover { text-decoration: underline; }

/* ---------- contact ---------- */
.contact { position: relative; padding: 0; color: #eee8dc; background: #0e1420; border-top: 0; overflow: hidden; }
.contact picture img { width: 100%; height: clamp(22rem, 45vw, 40rem); object-fit: cover; object-position: 50% 70%; }
.contact .contact-copy { position: relative; padding: var(--section) var(--gutter); margin-top: clamp(-14rem, -18vw, -6rem); background: linear-gradient(to bottom, rgba(14,20,32,0), #0e1420 30%); }
.contact h2 { margin: 0; color: #eee8dc; font: 400 var(--step-h2)/1.02 var(--font-display); letter-spacing: -0.015em; }
.channels { display: grid; gap: 0; margin: 2rem 0 0; padding: 0; list-style: none; max-width: 44rem; }
.channels li { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid #1f2a3d; }
.channels li span { color: #a7a08f; }
.channels a { color: #eee8dc; font-weight: 500; }
.channels a:hover { color: #f2a65a; }

.site-foot { padding: 2rem var(--gutter) 3rem; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* sticky brief bar on phones once the hero is gone */
.brief-bar { position: fixed; inset: auto 0 0 0; z-index: 40; display: none; padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--ground) 92%, transparent); border-top: 1px solid var(--rule); backdrop-filter: blur(8px); }
.brief-bar .btn { width: 100%; justify-content: center; }
@media (max-width: 759px) { .brief-bar.is-on { display: block; } body { padding-bottom: 0; } }

/* ---------- motion ---------- */
/* Reveals are scroll-driven CSS only: content is never hidden when unsupported or without JS. */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: lift 700ms var(--ease-out-expo) both; }
  .hero-copy > :nth-child(2) { animation-delay: 80ms; }
  .hero-copy > :nth-child(3) { animation-delay: 160ms; }
  .hero-copy > :nth-child(4) { animation-delay: 240ms; }
  @supports (animation-timeline: view()) {
    .rise { animation: lift linear both; animation-timeline: view(); animation-range: entry 0% entry 35%; }
  }
}
@keyframes lift { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media (max-width: 759px) {
  #how .frame, #rig .frame figcaption, #studio .frame figcaption { display: none; }
  #rig .frame img { max-height: 22rem; object-fit: cover; }
  #studio .frame { display: none; }
  .timeline li { padding-bottom: 1.4rem; }
}
