/* =========================================================
   VS Code Mobile Cheat Sheet — styles
   Fonts: Days One (display), Droid Sans (body), Fira Code (mono)
   Palette: dark charcoal gradient → cream-yellow text
   ========================================================= */

:root {
  /* Charcoal gradient stops */
  --bg-1: #0d1014;
  --bg-2: #16191f;
  --bg-3: #1c2026;
  /* Card surfaces — lifted ~5% off the body for clearer separation */
  --surface: rgba(255, 245, 210, 0.09);
  --surface-2: rgba(255, 245, 210, 0.12);
  --border: rgba(255, 245, 210, 0.10);
  --border-strong: rgba(255, 245, 210, 0.18);

  /* Mostly white text with a faint warm cast */
  --text: #fdfaf0;          /* primary — near-white */
  --text-soft: #f5f1e3;     /* secondary */
  --text-mute: #d8d3c0;     /* tertiary */
  --accent: #ffd76b;        /* warm highlight (titles, keys, rules) */
  --accent-2: #f7a93b;      /* deeper accent */

  /* Mono code background */
  --code-bg: rgba(0, 0, 0, 0.35);
  --code-border: rgba(255, 215, 107, 0.18);

  /* Type sizes — generous for readability with glasses */
  --fs-base: 16px;          /* phone body */
  --fs-mono: 15px;
  --fs-h1: clamp(1.9rem, 5.4vw, 3rem);
  --fs-h2: clamp(1.35rem, 3.6vw, 1.85rem);
  --fs-takeaway: clamp(1.05rem, 2.4vw, 1.18rem);

  --radius: 12px;
  --radius-sm: 7px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Droid Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, #21262d 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, #1a1f26 0%, transparent 55%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  /* Respect device safe areas (iOS notch / status bar / home indicator) when
     installed as a PWA in standalone mode. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

::selection { background: var(--accent); color: #1a1a1a; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding:
    calc(env(safe-area-inset-top, 0px) + 0.55rem)
    clamp(1rem, 4vw, 2rem)
    0.55rem;
  background: rgba(13, 16, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}
.brand-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #2a2f37, #15181d);
  border: 1px solid var(--border-strong);
  color: var(--accent);
}
.brand-name {
  font-family: "Days One", "Droid Sans", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-name .dim { color: var(--text-mute); font-weight: 400; }

/* Hamburger */
.menu-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.menu-btn:hover { background: var(--surface); border-color: var(--accent); }
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-btn .bars {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  position: relative;
  border-radius: 2px;
}
.menu-btn .bars::before,
.menu-btn .bars::after {
  content: "";
  position: absolute; left: 0;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.menu-btn .bars::before { top: -7px; }
.menu-btn .bars::after  { top:  7px; }

/* ---------- TOC drawer ---------- */
.toc-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 7, 10, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}
.toc-overlay.open { opacity: 1; pointer-events: auto; }
.toc-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100dvh;
  width: min(360px, 86vw);
  background: linear-gradient(180deg, #14171c 0%, #0e1115 100%);
  border-left: 1px solid var(--border-strong);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  /* Respect notch / status bar and home indicator inside the drawer too */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.toc-drawer.open { transform: translateX(0); }
.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.toc-head h2 {
  margin: 0;
  font-family: "Days One", sans-serif;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.toc-close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
}
.toc-close:hover { background: var(--surface); }
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.5rem 2rem;
  overflow-y: auto;
  flex: 1;
}
.toc-list a {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: 8px;
  font-size: 1rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.toc-list a:hover,
.toc-list a:focus-visible {
  background: var(--surface);
  color: var(--accent);
  outline: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(1.25rem, 3.2vw, 2.25rem) clamp(1rem, 4vw, 2rem) clamp(1rem, 2.4vw, 1.5rem);
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-family: "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--code-border);
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.7rem;
  background: rgba(255, 215, 107, 0.06);
}
.hero h1 {
  font-family: "Days One", sans-serif;
  font-size: var(--fs-h1);
  line-height: 1.05;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
  /* Wide multi-stop gradient that slowly slides across the title.
     200% width so the visible window is half the gradient — plenty of room
     to drift before looping. */
  background:
    linear-gradient(
      135deg,
      #ffd76b 0%,
      #ffe48a 14%,
      #fff0b8 28%,
      #fff8de 42%,
      #fffbef 50%,
      #fff8de 58%,
      #fff0b8 72%,
      #ffe48a 86%,
      #ffd76b 100%
    );
  background-size: 220% 220%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* 4.375s = 3.5s + 25%. cubic-bezier(0.45,0,0.55,1) is a near-linear ease that
     keeps the sweep super-smooth at the turnaround points without harsh stops. */
  animation: titleGradient 4.375s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes titleGradient {
  0%   { background-position:   0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1 { animation: none; }
}
.hero p.lede {
  margin: 0 auto;
  max-width: 60ch;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.45;
}
.hero-meta {
  margin-top: 0.7rem;
  font-family: "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--text-mute);
}

/* ---------- Sections ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
}
section.cheat {
  padding-top: clamp(1.25rem, 3vw, 2rem);
  scroll-margin-top: 72px;
}

/* Collapsible section disclosure */
.sec-details { }
.sec-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sec-summary::-webkit-details-marker { display: none; }
.sec-summary > h2 { margin: 0; }
.sec-chevron {
  display: inline-block;
  font-family: "Days One", sans-serif;
  color: var(--accent);
  font-size: 1.6rem;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 0.25s ease;
  opacity: 0.85;
  flex: 0 0 auto;
}
.sec-details[open] > .sec-summary .sec-chevron {
  transform: rotate(-90deg);
}
.sec-summary:hover .sec-chevron,
.sec-summary:focus-visible .sec-chevron { opacity: 1; }
.sec-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
.sec-body {
  /* Subtle reveal when expanded */
  animation: secReveal 0.28s ease-out;
}
@keyframes secReveal {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sec-body { animation: none; }
  .sec-chevron { transition: none; }
}
/* Subtitle gradient — yellow-white (upper-left) → white-cream (lower-right),
   45° with extra-smooth multi-stop interpolation. */
section.cheat h2 {
  font-family: "Days One", sans-serif;
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  background: linear-gradient(
    135deg,
    #ffe680 0%,
    #fff0a8 16%,
    #fff6c8 33%,
    #fff9dc 50%,
    #fffbe9 67%,
    #fffcf0 84%,
    #fff8e5 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Fallback for engines that ignore background-clip on text */
  -webkit-text-fill-color: transparent;
}
section.cheat .section-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 70%);
  margin-bottom: 0.7rem;
  opacity: 0.6;
}

/* ---------- Two-column table ---------- */
.cheat-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 1rem;
}
.cheat-table thead th {
  background: rgba(255, 215, 107, 0.08);
  color: var(--accent);
  font-family: "Days One", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border-strong);
}
.cheat-table tbody td {
  padding: 0.45rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  line-height: 1.4;
}
.cheat-table tbody tr:last-child td { border-bottom: none; }
.cheat-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }

/* Two-column proportions: ~40% shortcut / ~60% description */
.cheat-table thead th:nth-child(1),
.cheat-table tbody td:nth-child(1) { width: 40%; }
.cheat-table thead th:nth-child(2),
.cheat-table tbody td:nth-child(2) { width: 60%; }

/* Shortcut column — stacks Mac and Windows with platform labels */
.cheat-table .shortcut { display: flex; flex-direction: column; gap: 0.2rem; }
.cheat-table .shortcut .row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.cheat-table .shortcut .row.note {
  padding-left: 4px;
  color: var(--text-mute);
  font-size: 0.86rem;
  font-style: italic;
}
.cheat-table .shortcut .plat {
  font-family: "Days One", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  background: rgba(255, 215, 107, 0.10);
  border: 1px solid var(--code-border);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  flex: 0 0 auto;
  min-width: 46px;
  text-align: center;
}
.cheat-table .key {
  font-family: "Fira Code", "JetBrains Mono", monospace;
  font-size: var(--fs-mono);
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.45rem;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.4;
  /* Breathing room between glyphs so Mac modifier symbols (⇧⌘⌥⌃) don't visually merge */
  letter-spacing: 0.10em;
}
.cheat-table .desc { color: var(--text); }

/* Mobile: card list (portrait) */
@media (max-width: 640px) and (orientation: portrait) {
  .cheat-table { display: block; border: none; background: transparent; padding: 0; }
  .cheat-table thead { display: none; }
  .cheat-table tbody { display: block; }
  .cheat-table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.4rem;
  }
  .cheat-table td {
    display: block;
    padding: 0;
    width: auto !important;
    border: none !important;
    background: transparent !important;
  }
  /* No "SHORTCUT" / "WHAT IT DOES" labels on mobile — the layout speaks for itself */
  .cheat-table td[data-label]::before { content: none !important; }
  .cheat-table td:nth-child(2) { margin-top: 0.35rem; color: var(--text); }
  .cheat-table tbody tr:nth-child(even) td { background: transparent !important; }
  /* Mac and Win on one line; each platform's pill stays glued to its keychip. */
  .cheat-table .shortcut {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.45rem 0.6rem;
    align-items: center;
  }
  /* Each pill+key pair is its own no-wrap unit so the pill never strands. */
  .cheat-table .shortcut .row {
    flex-wrap: nowrap;
    gap: 0.35rem;
    max-width: 100%;
    min-width: 0;
  }
  /* Larger pill text on mobile for legibility */
  .cheat-table .shortcut .plat {
    font-size: 0.95rem;
    padding: 0.22rem 0.75rem;
    min-width: 60px;
  }
  /* Larger keychip text on mobile */
  .cheat-table .shortcut .row .key {
    font-size: 1.15rem;
    padding: 0.22rem 0.65rem;
    white-space: normal;
    word-break: break-word;
    min-width: 0;
  }
}

/* Code block (settings.json) */
.codeblock {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-family: "Fira Code", "JetBrains Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre;
}

/* Takeaway / gotcha block */
.takeaway {
  margin-top: 0.7rem;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  background: linear-gradient(90deg, rgba(255, 215, 107, 0.10), rgba(255, 215, 107, 0.02));
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--fs-takeaway);
  color: var(--text-soft);
  line-height: 1.5;
}
.takeaway strong {
  font-family: "Days One", sans-serif;
  color: var(--accent);
  font-weight: normal;
  letter-spacing: 0.01em;
  display: inline-block;
  margin-right: 0.35rem;
}

/* ---------- Footer ---------- */
.site-footer {
  padding:
    1.5rem
    clamp(1rem, 4vw, 2rem)
    calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-mute);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.25);
  line-height: 1.5;
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0.25rem 0; }

/* ---------- Scroll-to-top FAB ---------- */
#scroll-top {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(20, 23, 28, 0.85);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  z-index: 60;
}
#scroll-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#scroll-top:hover { background: rgba(28, 32, 38, 0.95); }
#scroll-top:active { transform: translateY(0) scale(0.96); }
#scroll-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---------- Print (optional) ---------- */
@media print {
  body { background: white; color: black; }
  .site-header, .toc-drawer, .toc-overlay { display: none !important; }
  .takeaway { background: #fff8e1; color: #333; border-color: #ffb74d; }
  .cheat-table .key { background: #f4f4f4; color: #333; border-color: #ccc; }
}
