/* ==========================================================
   Ear of the Wise — shared site styles
   Look: a naturalist's field journal. Cream paper, ink,
   ochre and moss accents. Every page links this file.
   ========================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400..900,50..100&family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --paper: #f6efe1;
  --paper-deep: #efe4cd;
  --card: #fffaf0;
  --ink: #1f2a44;
  --ink-soft: #4a5470;
  --line: #d9cbb0;
  --ochre: #d98e2b;
  --ochre-deep: #b8701a;
  --moss: #4f7a4a;
  --berry: #b54a5a;
  --sky: #3f7fa8;
  --plum: #6f5296;

  --math: var(--ochre);
  --science: var(--moss);
  --homeschool: var(--sky);

  --radius: 18px;
  --shadow: 0 1px 0 rgba(31, 42, 68, .08), 0 10px 30px -12px rgba(31, 42, 68, .25);
  --display: "Fraunces", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Trebuchet MS", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171c2b;
    --paper-deep: #11151f;
    --card: #20273a;
    --ink: #f2ead8;
    --ink-soft: #b9b3a3;
    --line: #343d55;
    --moss: #86b57e;
    --ochre-deep: #e8a24a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  /* faint graph-paper grid */
  background-image:
    linear-gradient(rgba(63, 127, 168, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 127, 168, .07) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; }

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

h1, h2, h3 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 100;
  line-height: 1.1;
  margin: 0 0 .4em;
  letter-spacing: -.01em;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px dashed var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
}
.brand svg { width: 40px; height: 40px; flex: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .95rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--paper-deep); }
@media (max-width: 560px) {
  .brand span { display: none; }
  .site-nav a { padding: 6px 9px; font-size: .9rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1.5px dashed var(--line);
  padding-block: 28px;
  color: var(--ink-soft);
  font-size: .95rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer em { font-family: var(--display); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 700 1rem var(--body);
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ochre-deep);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ochre-deep); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ochre-deep); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--paper-deep); }

/* ---------- Tool cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.tool-card {
  --accent: var(--ochre);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 22px 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .18s, border-color .18s;
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--accent);
}
.tool-card[data-cat="science"] { --accent: var(--science); }
.tool-card[data-cat="homeschool"] { --accent: var(--homeschool); }
a.tool-card:hover { transform: translateY(-4px) rotate(-.4deg); border-color: var(--accent); }
.tool-card .icon { font-size: 2.2rem; line-height: 1; }
.tool-card h3 { font-size: 1.3rem; margin: 6px 0 0; }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: .98rem; }
.tool-card .meta { margin-top: auto; padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
}
.tool-card.soon { opacity: .62; box-shadow: none; border-style: dashed; }
.tool-card.soon .tag.soon { border-color: var(--accent); color: var(--ink); }

/* ---------- Page heading (category pages) ---------- */
.page-head { padding-block: 48px 28px; }
.page-head .kicker {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
  color: var(--ink-soft);
}
.page-head h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
.page-head p { max-width: 60ch; color: var(--ink-soft); font-size: 1.1rem; }

/* ---------- Generic panel for tools/games ---------- */
.panel {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 32px);
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-soft);
}
.back-link:hover { color: var(--ink); }

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

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