/* style.css – base stylesheet for mike's website
   Replaces complete.css / YAML / iehacks.css.
   Load order: style.css first, then pages.css (inner pages only). */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #5b6372;
  --border: #d9dce3;
  --accent: #1d5fa8;
  --accent-contrast: #ffffff;
  --accent-soft: #e6f0fb;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.06);
  --radius: 12px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1d2128;
    --text: #e6e8ec;
    --muted: #a1a8b5;
    --border: #333943;
    --accent: #6cb0f5;
    --accent-contrast: #0e1217;
    --accent-soft: #1f2d3f;
    --shadow: 0 1px 3px rgba(0,0,0,.5);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 var(--font-body);
}

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

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

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

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p  { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: .5rem;
  top: -4rem;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: .5rem; }

/* ---- Page frame ---- */
.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
}

/* ---- Header & navigation ---- */
.site-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1rem;
  margin-bottom: 1.25rem;
}
.site-header h1 { margin-bottom: .75rem; }

#nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
#nav a {
  display: inline-block;
  padding: .35rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
#nav a:hover { background: var(--accent-soft); border-color: var(--accent); }
#nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

/* ---- Layout: content + sidebar ---- */
.layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 60rem) {
  .layout { grid-template-columns: minmax(0, 1fr) 20rem; }
}

main, .sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
/* On the index page, main only contains the feature block and cards:
   let those sit directly on the page background. */
main:has(> .cards) { background: transparent; border: 0; box-shadow: none; padding: 0; }

.sidebar { font-size: .95rem; }
.sidebar h2 { font-size: 1.2rem; }
.sidebar figure { margin: 0 0 1rem; }
.sidebar figure img { display: block; width: 100%; aspect-ratio: 268 / 402; object-fit: cover; border-radius: 8px; }
.sidebar figcaption { margin-top: .4rem; font-size: .8rem; color: var(--muted); }

@media (min-width: 60rem) {
  .sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

/* ---- Feature block (E-Lit teaser) ---- */
.feature {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
main:not(:has(> .cards)) .feature { margin-top: 0; }
.feature h2 { margin-bottom: .4em; }

.button {
  display: inline-block;
  padding: .5rem 1.2rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}
.button:hover { filter: brightness(1.1); }

/* ---- Cards ---- */
.cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card h3 { margin-bottom: .4em; }
.card p { flex: 1; color: var(--text); }
.card .more { align-self: flex-start; font-weight: 600; }
.card .more::after { content: " \2192"; }

/* ---- Footer ---- */
.site-footer {
  margin-top: 1.5rem;
  padding: 1rem 0;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---- Print ---- */
@media print {
  body { background: #fff; color: #000; }
  #nav, .skip-link, .button, .card .more { display: none; }
  main, .sidebar, .card, .site-header, .feature {
    box-shadow: none; border: 0; background: transparent; padding: 0;
  }
  .layout { display: block; }
  .sidebar { position: static; max-height: none; overflow: visible; }
  a { color: inherit; }
}
