/* ---------- Tokens ---------- */
:root {
  --bg: #12151c;
  --surface: #191d26;
  --surface-raised: #212736;
  --border: #2b3142;
  --border-soft: #232936;

  --text: #edf0f6;
  --text-dim: #9aa3b5;
  --text-faint: #6b7385;

  --accent: #5eead4;       /* teal — primary / "everyday" */
  --accent-dim: #3fb6a6;
  --beginner: #8fd98f;     /* soft green */
  --power: #f2a154;        /* amber */

  --radius: 6px;
  --shadow-menu: 0 12px 28px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);

  --font-display: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  padding: 22px 0;
}

.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark { text-decoration: none; }

.wordmark-menu {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-menu);
}

.wordmark-item {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 4px 9px;
  border-radius: 3px;
}

.wordmark-item--active {
  color: var(--bg);
  background: var(--accent);
  font-weight: 700;
}

.tagline {
  margin: 0;
  color: var(--text-faint);
  font-size: 14px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding: 72px 24px 64px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  margin-bottom: 18px;
}

.hero-lede {
  color: var(--text-dim);
  max-width: 46ch;
  font-size: 17px;
  margin: 0 0 28px;
}

.hero-cta {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--bg);
  background: var(--accent);
  padding: 11px 18px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.hero-cta:hover { background: var(--accent-dim); transform: translateY(2px); }

/* the context-menu hero device */
.menu-device {
  justify-self: center;
  width: 280px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  overflow: hidden;
}

.menu-device-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.menu-device-bar span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.menu-device-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  font-family: var(--font-body);
  font-size: 14px;
}

.menu-device-list li {
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--text-dim);
}

.menu-device-sep {
  height: 1px;
  padding: 0;
  margin: 6px 4px;
  background: var(--border-soft);
}

.menu-device-active {
  color: var(--bg) !important;
  background: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-device-active::after {
  content: "→";
}

/* ---------- Today card ---------- */
.today { padding: 8px 24px 56px; }

.today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.today-card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.level-tag, .category-tag {
  font-family: var(--font-display);
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.level-tag[data-level="beginner"] { color: var(--beginner); border-color: var(--beginner); }
.level-tag[data-level="everyday"] { color: var(--accent); border-color: var(--accent); }
.level-tag[data-level="power"]    { color: var(--power); border-color: var(--power); }

.today-card h2 {
  font-size: clamp(22px, 3vw, 28px);
  margin-bottom: 18px;
  max-width: 32ch;
}

.today-card-body {
  color: var(--text-dim);
  font-size: 16.5px;
  max-width: 68ch;
}

.today-card-body p { margin: 0 0 14px; }
.today-card-body p:last-child { margin-bottom: 0; }

.today-card-body code {
  font-family: var(--font-display);
  font-size: 0.9em;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}

.source-note {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 13.5px;
  color: var(--text-faint);
}

/* ---------- Archive ---------- */
.archive { padding: 8px 24px 80px; }

.archive-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.archive h2 { font-size: 20px; }

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.filter-tab {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.filter-tab.is-active {
  background: var(--surface-raised);
  color: var(--text);
}

.filter-tab:hover:not(.is-active) { color: var(--text); }

.scroll-hint {
  text-align: center;
  color: var(--text-faint);
  font-family: var(--font-display);
  font-size: 12.5px;
  margin: 0 0 8px;
  transition: opacity 0.3s ease;
}

/* ---------- Single-tip scroll viewer ---------- */
/* .tip-scroller is a tall spacer div; its height (set in JS) determines
   how much scrolling it takes to move through all loaded tips. The
   sticky .tip-viewer pins in place while that spacer scrolls underneath,
   showing exactly one tip-card at a time. */

.tip-scroller {
  position: relative;
  height: 200vh;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.tip-viewer {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
}

.tip-card {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  overflow: hidden;
}

.tip-card-content { padding: 28px 32px 32px; }

.tip-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.viewer-date-pill {
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--text-faint);
}

.tip-card-content h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 2.4vw, 22px);
  margin: 0 0 14px;
  max-width: 34ch;
}

.tip-card-body {
  color: var(--text-dim);
  font-size: 15.5px;
  max-width: 60ch;
  max-height: 30vh;
  overflow-y: auto;
}

.tip-card-body p { margin: 0 0 12px; }
.tip-card-body p:last-child { margin-bottom: 0; }

.tip-card-body code {
  font-family: var(--font-display);
  font-size: 0.9em;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}

.tip-viewer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tip-viewer-position {
  text-align: center;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--text-faint);
  min-width: 64px;
}

.tip-nav-btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.tip-nav-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }

.tip-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* On touch devices, scroll/swipe-driven paging is unreliable across
   browsers, so the section is a normal (non-pinned) block there and
   the Prev/Next buttons are the primary way to move between tips. */
@media (pointer: coarse) {
  .tip-scroller { height: auto; }
  .tip-viewer { position: relative; height: auto; padding: 32px 0 56px; }
  .scroll-hint { display: none; }
}

/* ---------- Fullscreen wipe transition ---------- */
/* Covers the entire viewport -- header and footer included -- and
   sweeps left to right. Tip content underneath swaps while it's fully
   covering, so the swap itself is never visible. */

.wipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
}

.wipe-overlay.is-active {
  visibility: visible;
  animation: wipeAcross 2.7s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes wipeAcross {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.wipe-overlay-inner {
  width: min(92vw, 143vh);
  max-width: 1600px;
}

.wipe-overlay-inner svg { display: block; width: 100%; height: auto; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 24px 0 40px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-faint);
  font-size: 13px;
}

.footer-legend { display: flex; align-items: center; gap: 6px; }

.disclaimer {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 12.5px;
  max-width: 68ch;
}

.legend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 10px;
}
.legend-dot:first-child { margin-left: 0; }

.legend-dot--beginner { background: var(--beginner); }
.legend-dot--everyday { background: var(--accent); }
.legend-dot--power { background: var(--power); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 48px;
    text-align: left;
  }
  .menu-device { justify-self: start; width: 100%; max-width: 320px; }
  .tip-card { max-width: 92vw; }
  .tip-card-content { padding: 20px 20px 24px; }
  .tip-card-body { max-height: 26vh; }
}
