/* Theme: Light Dark */
:root{
  --bg:#faf7f2; --ink:#1b1b1b; --muted:#555b66;
  --accent:#b36a00; --soft:#ffffff; --card:#ffffff; --ring: rgba(179,106,0,.45);
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#070707; --ink:#e5e6e8; --muted:#9aa0a6; --accent:#f59e0b; --soft:#111318; --card:#151821; --ring: rgba(245,158,11,.55); }
}
html[data-theme="light"]{ --bg:#f9f8f2; --ink:#070707; --muted:#555b66; --accent:#b36a00; --soft:#ffffff; --card:#ffffff; --ring: rgba(179,106,0,.45); }
html[data-theme="dark"]{ --bg:#070707; --ink:#e5e6e8; --muted:#9aa0a6; --accent:#f59e0b; --soft:#111318; --card:#151821; --ring: rgba(245,158,11,.55); }

/* Width fixe */
html{
  overflow-y:scroll;
  min-height:100%;

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.20),
      rgba(0,0,0,.04)
    ),
    url("scanned_paper_tilebg_sml.png");

  background-repeat:repeat;
  background-size:auto;
}

*{ box-sizing:border-box }

body{
  margin:0;
  min-height:100vh;

  font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans","Helvetica Neue",Arial;
  color:var(--ink);

  background:transparent;
  position:relative;
}

/* No pseudo-element paper layers. The parchment is painted once on html. */
body::before,
body::after{
  content:none;
}

/* safari doesn't show the link colors - use a different browser I guess - tired of fighting it */
/* fix: bare `a` forces Safari iOS to use our color instead of its UA blue */
a{ color:var(--accent); }

a:link,
a:visited{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
}

a:hover,
a:focus-visible{
  text-decoration-thickness:2px;
}


a:focus-visible{ outline:3px solid var(--ring); outline-offset:2px; border-radius:10px }
.wrap{ max-width:1150px; margin:0 auto; padding:24px }

/* Header */
header.site{ position:relative; z-index:100; display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; flex-wrap:nowrap; width:100%; }
nav a{ margin-right:12px; border-bottom:1px dotted transparent }



/* Buttons */
.btn{ font:14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; cursor:pointer; padding:8px 12px; border-radius:10px; border:1px solid rgba(27,27,27,0.20); background: var(--soft); color: var(--ink); -webkit-appearance:none; appearance:none; }
.btn:focus-visible{ outline:3px solid var(--ring); outline-offset:2px; }
@media (prefers-color-scheme: dark){ html:not([data-theme="light"]) .btn{ border-color: rgba(226,226,232,0.20); } }

/* Hamburger */
.hamburger{ display:none; font:14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; padding:8px 12px; border-radius:10px; border:1px solid rgba(27,27,27,0.20); background:var(--soft); color:var(--ink); cursor:pointer; -webkit-appearance:none; appearance:none; min-height:44px; }
.hamburger:focus-visible{ outline:3px solid var(--ring); outline-offset:2px }
@media (prefers-color-scheme: dark){ html:not([data-theme="light"]) .hamburger{ border-color: rgba(226,226,232,0.20); } }

/* Desktop nav row */
header.site > nav{ display:flex; align-items:center; gap:12px; flex:1 1 auto; min-width:0 }
header.site > nav .menu{ display:flex; gap:12px; align-items:center; white-space:nowrap; flex:0 1 auto }
header.site > .btn{ flex:0 0 auto; margin-left:auto; white-space:nowrap }

/* Mobile <= 840px */
@media (max-width: 840px){
  .hamburger{ display:inline-flex !important; align-items:center; gap:8px }
  header.site > nav .menu{
    position:absolute; top:calc(100% + 6px); left:16px; right:16px;
    background:var(--soft); border:1px solid rgba(27,27,27,0.20);
    border-radius:10px; padding:10px; display:none; flex-direction:column; gap:8px;
    box-shadow:0 10px 24px rgba(0,0,0,.18); z-index:1000;
  }
  header.site[data-menu-open="true"] > nav .menu{ display:flex !important }
}
@media (prefers-color-scheme: dark) and (max-width: 840px){ html:not([data-theme="light"]) header.site > nav .menu{ border-color: rgba(226,226,232,0.20); } }

/* Main & intro graphic */
main{ display:block }
.page-intro{ margin:20px 0 18px; display:grid; grid-template-columns:1fr; gap:8px; align-items:center }
.page-intro h1{ margin:0; font-size:clamp(26px,4vw,40px) }
.subhead{ margin:0; color:var(--muted); font-size:clamp(14px,2.5vw,18px) }

/* Sections */
.section{ background:linear-gradient(180deg,rgba(255,255,255,.02),transparent 40%), var(--card); border:2px solid rgba(140,90,20,.45);
  box-shadow:
    0 2px 8px rgba(0,0,0,.08),
    0 0 0 1px rgba(255,255,255,.25) inset; border-radius:10px; padding:16px; margin:14px 0; }
.section h2{ margin:0 0 8px; font-size:20px }

.section p{ overflow-wrap:anywhere; }

/* Art pics */
.page-intro-figure{
  background:linear-gradient(180deg,rgba(255,255,255,.02),transparent 40%), var(--card);
  border:2px solid rgba(140,90,20,.45);
  box-shadow:
    0 2px 8px rgba(0,0,0,.08),
    0 0 0 1px rgba(255,255,255,.25) inset;
  border-radius:10px;
  padding:16px;
  margin:14px 0;
  /* fix: browsers give figure a default margin that can cause overflow on mobile */
  max-width:100%;
  overflow:hidden;
}
.page-intro-figure img{
  width:100%;
  max-width:100%;
  height:auto;
  border-radius:6px;
  display:block;
}
.page-intro-figure figcaption{ color:var(--muted); font-size:14px; margin-top:6px }

.artcard{ display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:center; margin:20px 0;
  background:linear-gradient(180deg,rgba(255,255,255,.02),transparent 40%), var(--card);
  border:2px solid rgba(140,90,20,.45);
  box-shadow:
    0 2px 8px rgba(0,0,0,.08),
    0 0 0 1px rgba(255,255,255,.25) inset; border-radius:10px; padding:16px; }
.artcard img{ width:100%; height:auto; border-radius:10px; border:1px solid rgba(229,231,235,.10) }
@media (max-width: 840px){ .artcard{ grid-template-columns:1fr } }

/* Screenshot thumbnails */
.screenshot-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:12px;
  margin:12px 0 18px;
}

.screenshot-grid figure{
  margin:0;
  background:#000;
  border:1px solid rgba(27,27,27,0.20);
  border-radius:8px;
  overflow:hidden;
}

.screenshot-grid a{
  display:block;
}

.screenshot-grid img{
  display:block;
  width:100%;
  height:auto;
  image-rendering:pixelated;
}

.screenshot-grid figcaption{
  padding:6px 8px;
  background:var(--card);
  color:var(--muted);
  font-size:14px;
}

/* Updates / burrow log entries */
.updates{ margin:2rem 0 }
.update{ margin-bottom:1rem; padding:1rem 1.2rem;
  border-top:1px solid rgba(27,27,27,0.20);
  border-right:1px solid rgba(27,27,27,0.20);
  border-bottom:1px solid rgba(27,27,27,0.20);
  border-left:4px solid var(--accent);
  border-radius:10px; background: transparent; }
.update time{ display:block; font-size:0.9em; color:var(--muted); margin-bottom:0.3em; }
.update.past{ opacity:0.9; border-color: rgba(27,27,27,0.20) }
@media (prefers-color-scheme: dark){ html:not([data-theme="light"]) .update, html:not([data-theme="light"]) .update.past, html:not([data-theme="light"]) header.site .hamburger, html:not([data-theme="light"]) header.site > nav .menu, html:not([data-theme="light"]) .section, html:not([data-theme="light"]) .card, html:not([data-theme="light"]) .artcard, html:not([data-theme="light"]) .page-intro-figure{ border-color: rgba(226,226,232,0.20); } }

/* Back to top */
.backtotop{
  margin:20px 0 8px;
  text-align:center;
  font-size:14px;
}

.backtotop a{ color:var(--muted); }

.backtotop a:hover,
.backtotop a:focus-visible{
  color:var(--accent);
}

/* Footer */
footer{
  color:var(--muted);
  font-size:12px;
  padding:28px 0 8px;
  background:transparent;
  text-align:center;
}

/* tried footer border thing here... Hmm */
/* footer{ border-top: 1px solid rgba(27,27,27,0.10); } */

footer div{ text-align:center; }

/* fix motion */
@media (prefers-reduced-motion: reduce){ *{ transition:none !important } }

/* Mobile fixes */
@media (max-width: 480px){
  body{ font-size:17px; line-height:1.55; }
  .wrap{ padding:20px 16px; }
  .page-intro{ gap:12px; margin:18px 0; }
  .page-intro h1{ font-size:clamp(24px, 7vw, 32px); }
  .subhead{ font-size:clamp(14px, 4vw, 16px); }
  nav a, .btn, .hamburger{ padding:10px 12px; min-height:44px; }
  .hamburger{ font-size:15px; }
  header.site[data-menu-open="true"] nav .menu a{ display:block; padding:10px 12px; border-radius:10px; }
  .updates{ margin:1.5rem 0; }
  .updates h2{ font-size:20px; margin-bottom:10px; }
  .update{ padding:12px 14px; }
  .update time{ font-size:0.95em; }
  .page-intro-figure figcaption{ font-size:13px; }
  footer{ font-size:13px; padding:24px 0 10px; text-align:center; }
}
@media (max-width: 380px){
  header.site{ gap:10px; }
  header.site nav .menu{ left:12px; right:12px; }
  .wrap{ padding-left:14px; padding-right:14px; }
}

/* Removed fade-in because it fought with theme loading and looked weird on live server..  tried to get rid of dark mode flashing again */

/* TODO: active nav link highlight -- figure out later (or never looks ok now tbh) */
/* .nav-current{ font-weight:600; color:var(--accent); } */

/* Navigation readability on parchment
   Must come after global a:link/a:visited Safari fix.
   Explicit link/visited states prevent orange hover flash. */
header.site nav a,
header.site nav a:link,
header.site nav a:visited{
  color:var(--muted);
  font-weight:600;
  text-decoration:underline;
  text-underline-offset:2px;
  text-decoration-thickness:1px;
  border-bottom-color:transparent;
  transition:none;
}

header.site nav a:hover,
header.site nav a:focus-visible{
  color:var(--ink);
  font-weight:600;
  text-decoration:underline;
  text-decoration-thickness:2px;
  border-bottom-color:transparent;
  outline:none;
}
