/* ============================================================
   yatinmalik.com :: editorial-meets-technical
   Charcoal + warm white + burnt amber. Instrument Serif display.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* Palette */
  --bg: #0F0F11;
  --bg-2: #0A0A0C;
  --surface: #16161A;
  --text: #F5F5F3;
  --muted: #8A8A85;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-soft: rgba(255, 255, 255, 0.04);
  --accent: #C2410C;
  --accent-2: #D4A574;
  --accent-hover: #E45A1B;

  /* Type */
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-body: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Layout */
  --max: 1120px;
  --gutter: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--text); }

/* ----------  Layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 120px 0; border-top: 1px solid var(--hairline); }
.section:first-of-type { border-top: 0; }
.narrow { max-width: 720px; }
@media (max-width: 800px) {
  .section { padding: 80px 0; }
  :root { --gutter: 24px; }
}

/* ----------  Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: clamp(56px, 8vw, 96px); line-height: 1.02; }
h2 { font-size: clamp(40px, 5vw, 64px); }
h3 { font-size: clamp(26px, 2.8vw, 34px); }
h4 { font-size: 22px; letter-spacing: 0; }

em, .ital { font-style: italic; }

.accent-word {
  font-style: italic;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p {
  color: var(--text);
  max-width: 65ch;
  font-size: 18px;
  line-height: 1.55;
}
p + p { margin-top: 1em; }
p.muted { color: var(--muted); }

.lead {
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 60ch;
  font-weight: 400;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.kicker .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

a {
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: color 200ms var(--ease);
}
.article-body a,
p a {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
  transition: border-color 200ms var(--ease), color 200ms var(--ease);
}
.article-body a:hover,
p a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ----------  Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 15, 17, 0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }

.brand { display: inline-flex; align-items: baseline; gap: 14px; }
.brand .ym {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.brand .ym .slash {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 2px;
}
.brand .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 1px solid var(--hairline);
  padding-left: 14px;
}

.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 200ms var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active { color: var(--accent); }

.nav-cta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 200ms var(--ease), border-color 200ms var(--ease);
}
.nav-cta .arrow { display: inline-block; transition: transform 200ms var(--ease); }
.nav-cta:hover { background: var(--accent); border-color: var(--accent); }
.nav-cta:hover .arrow { transform: translateX(4px); }

/* ----------  Mobile menu toggle (hamburger) ---------- */
.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 12px;
  margin-right: -12px;
  color: var(--text);
  /* Sit above the drawer */
  position: relative;
  z-index: 200;
}
.menu-toggle .bars {
  display: block;
  width: 24px;
  height: 14px;
  position: relative;
}
.menu-toggle .bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--text);
  transition: transform 250ms var(--ease), opacity 200ms var(--ease), top 250ms var(--ease);
}
.menu-toggle .bars span:nth-child(1) { top: 0; }
.menu-toggle .bars span:nth-child(2) { top: 6.5px; }
.menu-toggle .bars span:nth-child(3) { top: 13px; }
/* Animate to × when open */
.menu-toggle[aria-expanded="true"] .bars span:nth-child(1) { top: 6.5px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .bars span:nth-child(3) { top: 6.5px; transform: rotate(-45deg); }

/* ----------  Mobile drawer ---------- */
/* Hidden on desktop — only becomes visible inside the media query */
.mobile-drawer {
  display: none;
}

/* Prevent body scroll while drawer is open */
body.menu-open { overflow: hidden; }

@media (max-width: 760px) {
  /* Hide desktop nav items */
  .nav-links,
  .brand .label,
  .nav-cta { display: none; }

  /* Show hamburger */
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* Drawer base state */
  .mobile-drawer {
    display: block;
    position: fixed;
    top: 76px; /* exactly the header height */
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 90; /* below header (100) but above everything else */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 300ms var(--ease),
      transform 300ms var(--ease),
      visibility 0ms linear 300ms; /* delay visibility so fade-out finishes first */
    overflow-y: auto;
    border-top: 1px solid var(--hairline);
    /* Prevent tap-through to content behind */
    pointer-events: none;
  }

  /* Drawer open state */
  .mobile-drawer.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition:
      opacity 300ms var(--ease),
      transform 300ms var(--ease),
      visibility 0ms linear 0ms;
    pointer-events: all;
  }

  .mobile-drawer-inner {
    padding: 32px var(--gutter) 48px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  .mobile-drawer .drawer-link {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 38px;
    line-height: 1.1;
    color: var(--text);
    padding: 22px 0;
    border-bottom: 1px solid var(--hairline);
    text-decoration: none;
    display: block;
    letter-spacing: -0.01em;
    /* Ensure tappable area is full width */
    width: 100%;
  }
  .mobile-drawer .drawer-link.active { color: var(--accent); }
  .mobile-drawer .drawer-link:hover { color: var(--accent); }

  .mobile-drawer .drawer-cta {
    margin-top: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    border: 1px solid var(--accent);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 18px 22px;
    text-decoration: none;
    /* Tappable feedback */
    transition: background 200ms var(--ease);
  }
  .mobile-drawer .drawer-cta:hover,
  .mobile-drawer .drawer-cta:active { background: var(--accent-hover); border-color: var(--accent-hover); }

  .mobile-drawer .drawer-meta {
    margin-top: auto;
    padding-top: 32px;
    border-top: 1px solid var(--hairline);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .mobile-drawer .drawer-meta a {
    color: var(--text);
    text-decoration: none;
    display: inline-block;
  }
  .mobile-drawer .drawer-meta a:hover { color: var(--accent); }
}

/* ----------  Hero ---------- */
.hero { padding: 140px 0 120px; border-top: 0; }
.hero .kicker { margin-bottom: 32px; }
.hero h1 { margin-bottom: 28px; max-width: 18ch; text-wrap: balance; }
.hero .lead { margin-bottom: 48px; }
.hero-meta {
  display: flex; gap: 32px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 10px; }
.hero-meta .dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }

/* Page-load stagger */
.fade-up { opacity: 0; transform: translateY(12px); animation: fadeUp 700ms var(--ease) forwards; }
.fade-up.d0 { animation-delay: 0ms; }
.fade-up.d1 { animation-delay: 100ms; }
.fade-up.d2 { animation-delay: 200ms; }
.fade-up.d3 { animation-delay: 300ms; }
.fade-up.d4 { animation-delay: 400ms; }
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ----------  Buttons ---------- */
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 16px 22px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
}
.btn .arrow { display: inline-block; transition: transform 200ms var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary:hover { border-color: var(--text); }

.btn-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 6px;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.btn-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.btn-link .arrow { transition: transform 200ms var(--ease); }
.btn-link:hover .arrow { transform: translateX(4px); }

/* ----------  Editorial rows ---------- */
.editorial-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  padding: 56px 0;
  border-top: 1px solid var(--hairline);
  transition: background 300ms var(--ease);
}
.editorial-row:hover { background: var(--hairline-soft); }
.editorial-row .row-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.editorial-row .row-label .num {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 42px;
  color: var(--accent);
  margin-bottom: 12px;
  line-height: 1;
}
.editorial-row h3 { margin-bottom: 16px; }
.editorial-row p { color: var(--muted); max-width: 56ch; font-size: 17px; }
.editorial-row .tags { margin-top: 20px; }
@media (max-width: 800px) {
  .editorial-row { grid-template-columns: 1fr; gap: 24px; padding: 40px 0; }
}

/* ----------  Card grid ---------- */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.card {
  background: var(--bg);
  padding: 40px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: background 300ms var(--ease), transform 300ms var(--ease);
  border: 0;
}
.card:hover { background: var(--surface); transform: translateY(-2px); }
.card .kicker { margin-bottom: 20px; }
.card h3 { margin-bottom: 14px; font-size: 28px; line-height: 1.1; }
.card p { color: var(--muted); font-size: 16px; max-width: 50ch; }
.card .more {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.card .more .arrow { transition: transform 200ms var(--ease); }
.card:hover .more .arrow { transform: translateX(4px); }
@media (max-width: 800px) {
  .card-grid { grid-template-columns: 1fr; }
  .card { padding: 28px 20px; }
}

/* ----------  Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.stat { padding: 40px 24px 40px 0; border-right: 1px solid var(--hairline); }
.stat:last-child { border-right: 0; }
.stat .num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 64px;
  line-height: 1;
  color: var(--text);
}
.stat .num .accent-word { font-size: inherit; }
.stat .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 12px;
}
@media (max-width: 800px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
}

/* ----------  Two-column editorial ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.two-col .col h3 { font-size: 32px; margin-bottom: 16px; }
.two-col .col p { color: var(--muted); }
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; gap: 40px; }
}

/* ----------  Section heads ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 64px;
  flex-wrap: wrap;
  gap: 20px;
}
.section-head h2 { max-width: 18ch; text-wrap: balance; }
.section-head .kicker { margin-bottom: 16px; display: inline-flex; }

/* ----------  Article body ---------- */
.article-header { padding: 120px 0 56px; }
.article-header .kicker { margin-bottom: 32px; }
.article-header h1 { font-size: clamp(44px, 6vw, 72px); margin-bottom: 28px; max-width: 22ch; text-wrap: balance; }
.article-header .lead { font-size: 22px; max-width: 56ch; }
.article-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.article-body { padding: 0 0 120px; max-width: 680px; margin: 0 auto; }
.article-body h2 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  margin: 64px 0 24px;
  letter-spacing: -0.01em;
}
.article-body h3 { font-size: 24px; margin: 44px 0 16px; font-family: var(--font-body); font-weight: 600; }
.article-body p { font-size: 19px; line-height: 1.65; color: var(--text); margin-bottom: 22px; max-width: 65ch; }
.article-body p.muted, .article-body p:has(+ h2) { color: var(--text); }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body ul, .article-body ol { margin: 0 0 28px 24px; }
.article-body li { font-size: 19px; line-height: 1.65; color: var(--text); margin-bottom: 10px; }
.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 28px;
  margin: 36px 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 28px;
  line-height: 1.25;
  color: var(--text);
}
.article-body code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 2px 8px;
  font-size: 0.88em;
  border-radius: 3px;
}

/* ----------  Forms ---------- */
.form-grid { display: grid; gap: 24px; max-width: 540px; }
label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
input, textarea, select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text);
  transition: border-color 200ms var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-bottom-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 12px) center; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
textarea { min-height: 120px; resize: vertical; }

/* ----------  Tags ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  color: var(--muted);
  margin-right: 6px;
}

/* ----------  Footer ---------- */
.site-footer { border-top: 1px solid var(--hairline); padding: 80px 0 48px; }
.foot-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 64px; }
.foot-col h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 20px;
}
.foot-col a { display: block; font-family: var(--font-body); font-size: 15px; color: var(--text); margin-bottom: 10px; transition: color 200ms var(--ease); }
.foot-col a:hover { color: var(--accent); }
.foot-col p { color: var(--muted); font-size: 14px; max-width: 36ch; }
.foot-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.foot-bottom .accent-word { font-size: inherit; }
@media (max-width: 760px) {
  .foot-row { grid-template-columns: 1fr 1fr; gap: 32px; }
  .foot-bottom { flex-direction: column; gap: 14px; }
}

/* ----------  Centered moments ---------- */
.center { text-align: center; }
.center .lead, .center p { margin-left: auto; margin-right: auto; }
.center .kicker { justify-content: center; }
.center .btn-row { justify-content: center; }

/* ----------  Divider ---------- */
.divider { height: 1px; background: var(--hairline); margin: 64px 0; }

/* ----------  Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .fade-up { opacity: 1; transform: none; }
}
