/* ============================================================
   chateloin.com — Direction C "Field Notes"
   Component styles. Everything reads from tokens.css.
   ============================================================ */

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

html { scroll-behavior: smooth; }

html { overflow-x: clip; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: var(--leading-tight); text-wrap: balance; }
p { margin: 0; max-width: var(--measure); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color var(--t-fast) ease, color var(--t-fast) ease;
}
a:hover { border-bottom-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--accent-wash); }

.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg-panel); color: var(--text);
  padding: var(--s-2) var(--s-4); border: 1px solid var(--line-2);
  z-index: 10;
}
.skip-link:focus { left: var(--s-4); }

/* --- mono data layer --- */
.mono { font-family: var(--font-mono); }
.label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* --- header / nav --- */
.site-header { padding-top: var(--s-6); }
.site-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-4); flex-wrap: wrap;
}
.site-name {
  font-family: var(--font-mono);
  font-weight: 600; font-size: var(--text-meta);
  color: var(--text); border-bottom: none; letter-spacing: 0.02em;
}
.site-name:hover { color: var(--accent); }
.nm-abbr { display: none; }
@media (max-width: 480px) {
  .nm-full { display: none; }
  .nm-abbr { display: inline; }
}
.nav-links {
  display: flex; align-items: center; gap: var(--s-4);
  font-family: var(--font-mono); font-size: var(--text-meta);
}
.nav-links a {
  color: var(--text-2); border-bottom: none;
  padding: var(--s-1) 0; min-height: 44px; display: inline-flex; align-items: center;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--accent); }

.theme-toggle {
  font-family: var(--font-mono); font-size: var(--text-label);
  color: var(--text-2); background: none;
  border: 1px solid var(--line-2); border-radius: 4px;
  padding: var(--s-1) var(--s-2); cursor: pointer;
  min-height: 32px; min-width: 62px; white-space: nowrap;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-soft); }

/* --- hero --- */
.hero {
  position: relative;
  padding: var(--s-24) 0 var(--s-16);
  display: flex; flex-direction: column; gap: var(--s-4);
}
@media (max-width: 640px) { .hero { padding: var(--s-16) 0 var(--s-12); } }

.hero-grid {
  position: absolute; top: var(--s-8); right: calc(-1 * var(--s-8));
  width: 250px; height: 160px;
  opacity: 0.45; pointer-events: none;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(closest-side, #000 25%, transparent);
          mask-image: radial-gradient(closest-side, #000 25%, transparent);
}
@media (max-width: 640px) { .hero-grid { width: 140px; height: 110px; right: calc(-1 * var(--s-4)); } }

.hero-kicker { color: var(--text-3); }
.hero-kicker .tick { color: var(--accent); }

.hero-pos {
  font-size: var(--text-pos);
  font-weight: 620;
  letter-spacing: -0.018em;
  max-width: 26ch;
}
.hero-sup { font-size: var(--text-support); color: var(--text-2); }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-6);
  font-family: var(--font-mono); font-size: var(--text-meta);
  color: var(--text-3); margin-top: var(--s-3);
}

/* --- sections --- */
.section { padding-bottom: var(--s-16); }
.section-h {
  display: flex; align-items: baseline; gap: var(--s-3);
  color: var(--text-3);
  border-top: 1px solid var(--line);
  padding: var(--s-4) 0 var(--s-6);
}
.section-h .tick { color: var(--accent); }

/* --- work cards --- */
.work-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-4);
}
@media (max-width: 760px) { .work-grid { grid-template-columns: 1fr; } }

.work-card {
  display: flex; flex-direction: column; gap: var(--s-3);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-6);
  transition: border-color var(--t-fast) ease;
}
.work-card:hover { border-color: var(--line-2); }
.work-card .label { color: var(--accent); }
.work-card h3 { font-size: var(--text-title); font-weight: 620; letter-spacing: -0.01em; }
.work-card p { font-size: var(--text-small); color: var(--text-2); }
.card-meta {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  font-family: var(--font-mono); font-size: var(--text-label);
  letter-spacing: 0.03em; color: var(--text-3);
  margin-top: auto; padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

/* --- about --- */
.about-layout {
  display: grid; grid-template-columns: auto 1fr;
  gap: var(--s-6); align-items: start;
}
.about-photo { margin: 0; display: flex; flex-direction: column; gap: var(--s-2); }

/* Mobile: float the photo so the bio text wraps around it (magazine style),
   instead of stacking with dead space beside the small square.
   Must come AFTER the base .about-photo rule above: same specificity, so
   source order decides, and the base margin: 0 would otherwise wipe out the
   gutter here and leave the bio text touching the photo. */
@media (max-width: 640px) {
  .about-layout { display: block; overflow: hidden; }
  .about-photo { float: left; margin: 0.15rem var(--s-4) var(--s-2) 0; }
  .about-body { display: block; }
  .about-body p + p { margin-top: var(--s-3); }
}
.about-photo img,
.about-photo-ph {
  display: block; width: 110px; height: 110px;
  border-radius: var(--radius); border: 1px solid var(--line);
  object-fit: cover; background: var(--bg-panel);
}
.about-photo-ph { display: grid; place-items: center; }
.about-photo-ph svg { width: 46%; height: 46%; fill: var(--text-3); opacity: 0.55; }
.about-photo-cap {
  font-family: var(--font-mono); font-size: var(--text-label);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-3);
}
@media (max-width: 640px) {
  .about-photo img, .about-photo-ph { width: 80px; height: 80px; }
}

.about-body { display: flex; flex-direction: column; gap: var(--s-3); color: var(--text); }
.about-body p { max-width: 60ch; }

/* --- footer --- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-top: var(--s-6);
  padding-bottom: var(--s-12);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--s-2) var(--s-6);
  font-family: var(--font-mono); font-size: var(--text-meta); color: var(--text-3);
}
.site-footer a { color: var(--text-2); border-bottom-color: transparent; }
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }

/* --- entrance motion (voice: one orchestrated moment) --- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: reveal var(--t-slow) var(--ease-out) forwards;
    animation-delay: var(--d, 0ms);
  }
  @keyframes reveal { to { opacity: 1; transform: none; } }
}
