/* ==========================================================================
   kylesilverstein.com: shared styles
   Page-specific styles live in gallery.css, experiments.css, winamp.css, login.css
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #efece4;
  --ink: #1d2320;
  --muted: #545d58;
  --line: #ddd8cc;
  --accent: #4a7300;        /* olive green, a nod to the original site's #385900 / #8BBA00 */
  --accent-bright: #8bba00;
  --accent-soft: #e9f0d6;
  --accent-2: #006f8a;      /* teal from the old login box (#008aab), darkened for contrast */
  --focus: #006f8a;
  --shadow: 0 1px 2px rgb(30 30 20 / .06), 0 4px 16px rgb(30 30 20 / .06);
  --radius: 14px;
  --radius-sm: 8px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121513;
    --surface: #1a1f1c;
    --surface-2: #222824;
    --ink: #e8ece7;
    --muted: #a6afa9;
    --line: #2f3732;
    --accent: #a5d23a;
    --accent-bright: #a5d23a;
    --accent-soft: #24301a;
    --accent-2: #5cc4dd;
    --focus: #5cc4dd;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

main { flex: 1 0 auto; }

img, video, svg { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(2rem, 1.4rem + 2.4vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(1.45rem, 1.2rem + 1vw, 1.85rem); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }

a { color: var(--accent-2); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .6rem;
}

.lede { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }

/* ---------- Header & navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}

.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-serif); font-weight: 600; font-size: 1.2rem;
  margin-right: auto;
  white-space: nowrap;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 9px;
  background: var(--ink); color: var(--bg);
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700; letter-spacing: -.02em;
}
.brand-mark span { color: var(--accent-bright); }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.site-nav a {
  display: block;
  padding: .45rem .75rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem; font-weight: 500;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

.header-tools { display: flex; align-items: center; gap: .4rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }

.sound-toggle .icon-off { display: none; }
.sound-toggle[aria-pressed="false"] .icon-on { display: none; }
.sound-toggle[aria-pressed="false"] .icon-off { display: block; }
.sound-toggle[aria-pressed="false"] { color: var(--muted); }

.nav-toggle { display: none; }

@media (max-width: 52rem) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: .5rem var(--gutter) 1rem;
  }
  .js .site-nav:not(.is-open) { display: none; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: 1.05rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--muted);
  font-size: .9rem;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; align-items: center; }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; }
.footer-links { display: flex; gap: 1.25rem; list-style: none; padding: 0; margin: 0; }

/* ---------- Page header ---------- */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit; font-size: .95rem; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--accent)); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn svg { width: 1em; height: 1em; }

/* ---------- Cards (shared) ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

/* ==========================================================================
   Home page
   ========================================================================== */
/* Full-screen banner, as on the original homepage. The "Recently built"
   tiles start just below it, so their heading peeks above the fold. */
.landing {
  position: relative;
  min-height: calc(100vh - 4rem - 5.5rem);
  min-height: calc(100svh - 4rem - 5.5rem);
  display: flex; justify-content: center; align-items: flex-start;
  padding: clamp(4rem, 16vh, 11rem) var(--gutter) 2rem;
  background: #dfeef0 url(../images/banner.jpg) center bottom / cover no-repeat;
  text-align: center;
  color: #1d2a33;                 /* the image is light in both themes */
}
.landing h1 {
  font-size: clamp(2.6rem, 1.6rem + 4.5vw, 4.75rem);
  margin: 0 0 .2em;
  text-shadow: 0 1px 12px rgb(255 255 255 / .7);
}
.landing .motto {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.3rem, 1.05rem + 1.2vw, 2rem);
  color: #24445a;
  margin: 0;
  text-shadow: 0 1px 10px rgb(255 255 255 / .8);
}
.latest-section { padding-top: 1.75rem; }

.section { padding-block: clamp(2.5rem, 6vw, 4rem) 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; }

.latest { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.latest a { display: flex; gap: 1rem; align-items: center; padding: .75rem; color: inherit; text-decoration: none; }
.latest a:hover { background: var(--surface-2); }
.latest img { width: 5.5rem; height: 3.6rem; object-fit: cover; border-radius: 6px; flex: none; background: var(--surface-2); }
.latest strong { display: block; line-height: 1.3; }
.latest span { font-size: .85rem; color: var(--muted); }

/* ---------- Simple pages (404, redirects) ---------- */
.center-page { padding-block: 5rem; text-align: center; }
.center-page .lede { margin-inline: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
