/* ============================================================
   Design Tokens — Light (default)
   ============================================================ */
:root {
  color-scheme: light;

  /* Colors */
  --color-bg: #f7f6f2;
  --color-surface: #edecea;
  --color-border: #d8d7d3;
  --color-text: #1a1a1a;
  --color-text-secondary: #6b6a66;
  --color-text-muted: #9a9996;
  --color-accent: #1a1a1a;
  --color-badge-toby: rgba(0, 0, 0, 0.08);
  --color-badge-external: rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --text-hero: clamp(3rem, 6vw, 7rem);
  --text-h1: clamp(2rem, 4vw, 4rem);
  --text-h2: clamp(1.4rem, 2.5vw, 2.2rem);
  --text-h3: clamp(1.1rem, 1.8vw, 1.5rem);
  --text-base: 1rem;
  --text-sm: 0.875rem;
  --text-xs: 0.75rem;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;
  --space-section: clamp(4rem, 8vw, 10rem);

  /* Motion */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 600ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Design Tokens — Dark
   ============================================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #1a1a1a;
  --color-surface: #222222;
  --color-border: #2e2e2e;
  --color-text: #ffffff;
  --color-text-secondary: #888888;
  --color-text-muted: #555555;
  --color-accent: #ffffff;
  --color-badge-toby: rgba(255, 255, 255, 0.12);
  --color-badge-external: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   Reset & Base
   ============================================================ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  overscroll-behavior: none;
}

html.has-scroll-smooth {
  overflow: hidden;
  position: fixed;
  inset: 0;
}

::-webkit-scrollbar { display: none; }

::selection {
  background: var(--color-text);
  color: var(--color-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ============================================================
   Locomotive Scroll
   ============================================================ */
.c-scrollbar_thumb {
  background: #555;
  opacity: 1;
}

/* ============================================================
   Loader
   ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader_wrapper {
  text-align: center;
}

.loader_wrapper h3 {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.loader_wrapper h1 {
  font-family: var(--font-heading);
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 400;
  line-height: 1;
  color: var(--color-text);
}

.bar {
  width: 200px;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-sm) auto 0;
  overflow: hidden;
}

.bar_progress {
  height: 100%;
  width: 0;
  background: var(--color-text);
  transition: width 0.1s linear;
}

/* ============================================================
   Navigation
   ============================================================ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: var(--space-md) clamp(1.5rem, 5vw, 4rem);
  background: rgba(247, 246, 242, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] nav {
  background: rgba(26, 26, 26, 0.88);
}

nav > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

nav .links {
  display: flex;
  gap: var(--space-md);
}

nav .links a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: color var(--duration-fast);
  letter-spacing: 0.02em;
}

nav .links a:hover {
  color: var(--color-text);
}

nav .menu {
  display: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 2rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding: 0.25rem 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast);
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

/* Mobile nav overlay */
.navigation_menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(360px, 100%);
  height: 100%;
  background: var(--color-surface);
  z-index: 200;
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: right var(--duration-slow) var(--ease-out);
}

.navigation_menu.active {
  right: 0;
}

.navigation_menu .links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.navigation_menu .links a {
  font-family: var(--font-heading);
  font-size: var(--text-h2);
  font-weight: 400;
  transition: opacity var(--duration-fast);
}

.navigation_menu .links a:hover {
  opacity: 0.6;
}

.navigation_menu .close {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}

#overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ============================================================
   Horizontal Line
   ============================================================ */
.horizontalLine {
  width: 100%;
  height: 1px;
  background: var(--color-border);
}

/* ============================================================
   Main wrapper (locomotive scroll target)
   ============================================================ */
#main {
  /* Locomotive needs a height reference */
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: var(--space-lg) clamp(1.5rem, 5vw, 4rem);
  padding-top: 8rem;
}

.hero > div {
  width: 100%;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.hero-tagline {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
}


/* ============================================================
   About Section (Home)
   ============================================================ */
.about {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  padding: var(--space-section) clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}

.about h2 {
  font-family: var(--font-heading);
  font-size: var(--text-h2);
  font-weight: 400;
  line-height: 1.2;
  max-width: 20ch;
}

.separator {
  width: 1px;
  background: var(--color-border);
  align-self: stretch;
}

.about > div p {
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 50ch;
}

.about > div p + p {
  margin-top: var(--space-md);
}

/* ============================================================
   Arrow Link
   ============================================================ */
.arrowLink {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  margin-top: var(--space-md);
  transition: gap var(--duration-normal) var(--ease-out);
}

.arrowLink:hover {
  gap: 1rem;
}

.arrowLink img {
  width: 16px;
  filter: none;
  transition: transform var(--duration-normal) var(--ease-out);
}

[data-theme="dark"] .arrowLink img {
  filter: invert(1);
}

.arrowLink:hover img {
  transform: translateX(4px);
}

/* ============================================================
   Tools Grid (Home preview + full /tools page)
   ============================================================ */
.tools-section {
  padding: var(--space-section) clamp(1.5rem, 5vw, 4rem);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-lg);
}

.section-heading h1 {
  font-family: var(--font-heading);
  font-size: var(--text-h1);
  font-weight: 400;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/* Filter buttons */
.tools-filter {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.filter-btn {
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2rem;
  transition: all var(--duration-fast);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

/* Tool list rows (like Flow Mint project links) */
#toolWrapper,
#toolWrapperHome {
  width: 100%;
}

#toolWrapper a,
#toolWrapperHome a {
  display: grid;
  grid-template-columns: 3rem auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  transition: padding-left var(--duration-normal) var(--ease-out),
              color var(--duration-fast);
}

#toolWrapper a:first-child,
#toolWrapperHome a:first-child {
  border-top: 1px solid var(--color-border);
}

#toolWrapper a:hover,
#toolWrapperHome a:hover {
  padding-left: var(--space-sm);
  color: var(--color-text);
}

#toolWrapper a p:first-child,
#toolWrapperHome a p:first-child {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Name cell — flex so h3 + icon sit inline */
.tool-row-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

#toolWrapper a h3,
#toolWrapperHome a h3 {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: 400;
  white-space: nowrap;
}

/* External link icon — appears on row hover */
.tool-ext-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-size: 0.65rem;
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--duration-fast),
              color var(--duration-fast),
              border-color var(--duration-fast);
}

#toolWrapper a:hover .tool-ext-link,
#toolWrapperHome a:hover .tool-ext-link {
  opacity: 1;
}

.tool-ext-link:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

#toolWrapper a h5,
#toolWrapperHome a h5 {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  min-width: 0;
}

/* Source badge */
.source-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.source-badge.toby {
  background: var(--color-badge-toby);
  color: var(--color-text);
}

.source-badge.external {
  background: var(--color-badge-external);
  color: var(--color-text-secondary);
}

/* Hover image reveal */
#image-reveal {
  position: fixed;
  top: 0;
  left: 0;
  width: 480px;
  height: 270px; /* 16:9 — matches auto-generated Notion screenshots */
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  pointer-events: none;
  z-index: 50;
  display: none;
  will-change: transform;
  overflow: hidden;
}

/* ============================================================
   Tool Single Page
   ============================================================ */
.tool-single {
  padding: var(--space-section) clamp(1.5rem, 5vw, 4rem);
  padding-top: calc(var(--space-section) + 4rem);
}

.tool-single-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  transition: color var(--duration-fast);
}

.tool-single-back:hover {
  color: var(--color-text);
}

.tool-single-header {
  margin-bottom: var(--space-lg);
}

.tool-single-header .source-badge {
  margin-bottom: var(--space-sm);
}

.tool-single-header h1 {
  font-family: var(--font-heading);
  font-size: var(--text-h1);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
}

.tool-single-header p {
  font-size: var(--text-h3);
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 60ch;
}

.tool-single-screenshot {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

.tool-single-screenshot-placeholder {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.tool-single-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  border-radius: 2rem;
  transition: opacity var(--duration-fast);
  margin-top: var(--space-md);
}

.tool-single-cta:hover {
  opacity: 0.85;
}

/* ============================================================
   About Page
   ============================================================ */
.about-page {
  padding: var(--space-section) clamp(1.5rem, 5vw, 4rem);
  padding-top: calc(var(--space-section) + 4rem);
  max-width: 800px;
}

.about-page h1 {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.05;
  margin-bottom: var(--space-lg);
}

.about-page p {
  font-size: var(--text-h3);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
  max-width: 55ch;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
  transition: color var(--duration-fast);
}

.about-link:hover {
  color: var(--color-text);
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: var(--space-lg) clamp(1.5rem, 5vw, 4rem);
  border-top: 1px solid var(--color-border);
}

.footer_links {
  display: flex;
  gap: var(--space-md);
}

.footer_links a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: color var(--duration-fast);
}

.footer_links a:hover {
  color: var(--color-text);
}

footer h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 5rem);
  font-weight: 400;
  line-height: 1;
  color: var(--color-text-muted);
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
}

.footer-meta p {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  nav .links {
    display: none;
  }

  nav .menu {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .about {
    grid-template-columns: 1fr;
  }

  .separator {
    display: none;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  /* Filter buttons: larger tap targets on mobile */
  .tools-filter {
    flex-wrap: wrap;
  }

  .filter-btn {
    min-height: 44px;
    padding: 0.6rem 1.2rem;
  }

  #toolWrapper a,
  #toolWrapperHome a {
    grid-template-columns: 2.5rem 1fr;
    grid-template-rows: auto auto;
    /* Ensure minimum tap height */
    min-height: 60px;
  }

  #toolWrapper a h5,
  #toolWrapperHome a h5,
  .source-badge {
    display: none;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .footer-meta {
    align-items: flex-start;
  }

  /* Mobile nav links: larger tap targets */
  .navigation_menu .links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .ascii-hero {
    display: none;
  }
}

/* ============================================================
   Utility
   ============================================================ */
.mT2 { margin-top: var(--space-md); }
.mT4 { margin-top: var(--space-lg); }

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