/* OverEngineered-Tech: shared styles for every page. */

:root {
  --bg: #fdfaf6;
  --surface: #ffffff;
  --text: #1c1e21;
  --muted: #5f6670;
  --line: #e6e0d8;
  --accent: #0b5fc5;
  --accent-text: #ffffff;
  --code-bg: #f4efe8;
  --nav-h: 60px;
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b21;
  --text: #e6edf3;
  --muted: #8b949e;
  --line: #282e38;
  --accent: #58a6ff;
  --accent-text: #0b1220;
  --code-bg: #0b0d11;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); }
img { max-width: 100%; }
a:focus-visible, button:focus-visible, summary:focus-visible, .tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* ---------- Top bar, slide-in menu, theme toggle ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.navbar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 14px;
}
.burger, .theme, .drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
}
.burger:hover, .theme:hover, .drawer-close:hover { background: rgba(127, 127, 127, 0.16); }
.burger svg, .theme svg, .drawer-close svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; letter-spacing: -0.2px; }
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0b0d11;
  color: #e8c66a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}
.navlinks { display: none; margin-left: auto; align-items: center; gap: 4px; }
.navlinks a { color: inherit; opacity: 0.75; text-decoration: none; font-size: 0.95rem; padding: 8px 10px; border-radius: 8px; }
.navlinks a:hover, .navlinks a[aria-current="page"] { opacity: 1; background: rgba(127, 127, 127, 0.14); }
.navbar .theme { margin-left: auto; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }

.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.5); }
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  width: min(300px, 84vw);
  background: var(--bg);
  color: var(--text);
  border-right: 1px solid var(--line);
  transform: translateX(-102%);
  transition: transform 0.22s ease;
  visibility: hidden;
  overflow-y: auto;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 10px; height: var(--nav-h); padding: 0 14px; border-bottom: 1px solid var(--line); }
.drawer-head .drawer-close { margin-left: auto; }
.drawer nav { padding: 10px 8px; }
.drawer nav a { display: block; color: inherit; opacity: 0.85; text-decoration: none; font-weight: 600; padding: 12px 12px; border-radius: 8px; }
.drawer nav a:hover, .drawer nav a[aria-current="page"] { opacity: 1; background: rgba(127, 127, 127, 0.14); }

@media (min-width: 900px) {
  .burger { display: none; }
  .navlinks { display: flex; }
  .navbar .theme { margin-left: 4px; }
}

/* ---------- Home page: full-screen Vitruvian Man hero ---------- */
body.home { background: #0b0d11; color: #fff; }
.navbar--hero {
  position: absolute;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom: 0;
  color: #fff;
}
.navbar--hero .logo { background: #fff; color: #0b0d11; }
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #0b0d11;
}
.hero-art { position: absolute; inset: 0; }
.hero-art img {
  position: absolute;
  top: 0;
  left: 50%;
  height: 74svh;
  width: auto;
  max-width: none;
  filter: brightness(0.6) contrast(1.08) saturate(0.9);
  transform: translateX(-50%);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, #0b0d11 6%, rgba(11, 13, 17, 0.55) 38%, rgba(11, 13, 17, 0.25) 62%, rgba(11, 13, 17, 0.5) 100%);
}
.hero-text { position: relative; z-index: 2; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 22px 12vh; }
.hero-text h1 { font-weight: 300; font-size: clamp(2.4rem, 8.5vw, 5rem); letter-spacing: -1.5px; line-height: 1.04; margin-bottom: 14px; }
.hero-text p { max-width: 30rem; color: rgba(255, 255, 255, 0.72); font-size: 1.1rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.pill {
  display: inline-block;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  background: rgba(11, 13, 17, 0.35);
  backdrop-filter: blur(4px);
}
.pill:hover { background: rgba(255, 255, 255, 0.16); }
.hero-more {
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.85rem;
  text-decoration: none;
}
.hero-more__title { color: rgba(255, 255, 255, 0.6); font-weight: 600; letter-spacing: 0.2px; }
.hero-more:hover { color: rgba(255, 255, 255, 0.8); }
body.home footer { max-width: 1200px; margin: 0 auto; padding: 18px 22px 28px; border-top: 0; color: rgba(255, 255, 255, 0.55); }

@media (min-width: 900px) {
  .hero-art img { left: auto; right: 7vw; height: 94svh; top: 3svh; transform: none; }
  .hero::before {
    background:
      linear-gradient(to right, #0b0d11 18%, rgba(11, 13, 17, 0.55) 52%, rgba(11, 13, 17, 0.3) 100%),
      linear-gradient(to top, #0b0d11 2%, transparent 30%);
  }
  .hero-text { padding: 0 32px 16vh; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .drawer { transition: none; }
}

/* ---------- Breadcrumb and page headings ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 24px 0 18px; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: "\203A"; margin-right: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs svg { width: 16px; height: 16px; vertical-align: -3px; fill: currentColor; }
.crumbs [aria-current="page"] { color: var(--accent); }
.page h1 { font-size: 2rem; letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 10px; }
.page h2 { font-size: 1.3rem; margin: 34px 0 10px; }
.page h3 { font-size: 1.05rem; }
.lead { color: var(--muted); font-size: 1.08rem; margin-bottom: 24px; }
.page p, .page li { margin-bottom: 9px; }
.page ul, .page ol { padding-left: 22px; margin-bottom: 8px; }
.prose { max-width: 760px; }
.note { color: var(--muted); font-size: 0.92rem; }
.photo { display: block; width: 100%; height: auto; max-height: 480px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 10px; }
.photo.contain { object-fit: contain; background: #fff; }

/* ---------- Photo tiles (section pages) ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 8px 0 24px; }
.tile { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: #0b0d11; color: #fff; text-decoration: none; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.tile img.contain { object-fit: contain; background: #fff; }
.photo.contain.widget, .tile img.contain.widget { background: #f2f2f7; }
.tile:hover img { transform: scale(1.04); }
.tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 10px; text-align: center; font-weight: 600; background: rgba(11, 13, 17, 0.72); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); gap: 18px; } }

/* ---------- File panels (Copy / Download) ---------- */
.file { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; margin-bottom: 12px; }
.file-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 0; }
.file-head h3 { margin: 0; }
.ver { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.file .desc { color: var(--muted); font-size: 0.93rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 6px; }
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.45; cursor: default; }
.status { font-size: 0.9rem; color: var(--muted); margin: 4px 0 0; }
.status:empty { display: none; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); font-size: 0.92rem; padding: 6px 0; }
textarea {
  display: block;
  width: 100%;
  height: 200px;
  margin-top: 8px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px; /* 16px stops iPhone Safari zooming in when the box is tapped */
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
}

/* ---------- FAQ ---------- */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; margin: 0 0 10px; }
.faq summary { font-weight: 600; color: var(--text); padding: 12px 0; }
.faq details p { margin: 0 0 14px; color: var(--muted); }

/* ---------- Vitruvian Man pages ---------- */
.vm-photo { max-width: 420px; max-height: 560px; margin: 4px 0 22px; }
.ratios { width: 100%; max-width: 460px; border-collapse: collapse; margin: 6px 0 22px; font-variant-numeric: tabular-nums; }
.ratios caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
.ratios caption .ver { font-weight: 400; margin-left: 8px; }
.ratios th, .ratios td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ratios th { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.ratios td:last-child, .ratios th:last-child { text-align: right; }
.ratios tbody tr:nth-child(odd) { background: var(--surface); }
.quote { margin: 0 0 18px; }
.it-list { max-width: 760px; margin-bottom: 8px; }
.it-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.it-row:first-child { padding-top: 4px; }
.it-row h3 { display: flex; justify-content: space-between; gap: 12px; font-size: 1rem; margin-bottom: 6px; }
.it-row h3 span { color: var(--accent); font-variant-numeric: tabular-nums; }
.page .it-row p { margin-bottom: 4px; }
.it { font-family: Georgia, Cambria, serif; font-style: italic; font-size: 1.05rem; }
.en { color: var(--muted); }
.aside { color: var(--muted); font-size: 0.85rem; border-left: 2px solid var(--line); padding-left: 10px; margin-top: 6px; }

/* ---------- Footer ---------- */
footer { margin-top: 56px; padding: 18px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
footer p { margin-bottom: 6px; }

@media (min-width: 700px) {
  .page h1 { font-size: 2.4rem; }
}

/* Support link on the Solar page */
.support { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin: 48px 0 0; padding: 22px 24px; border: 2px solid #ffdd00; border-radius: 12px; background: var(--surface); }
.support-text { flex: 1 1 240px; }
.support-text h2 { margin: 0 0 8px; font-size: 1.25rem; }
.support-text p { margin: 0 0 12px; }
.btn.coffee { background: #ffdd00; border-color: #ffdd00; color: #1a1a1a; }
.support-qr { width: 140px; height: 140px; background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.note.fine { margin-top: 64px; font-size: 0.85rem; }
