/* Home By The Sea — responsive story layout */

:root{
  --bg: #070c12;
  --bg2:#0b1b2a;
  --card:#0d1520;
  --card2:#0f2234;
  --text:#eaf0f6;
  --muted:#b7c2cf;
  --faint:#7f92a6;
  --line: rgba(255,255,255,.10);
  --accent:#7dd3fc;
  --accent2:#a78bfa;
  --danger:#fb7185;
  --note:#22c55e;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --radius: 16px;
  --radius2: 22px;
  --max: 78ch;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Light theme (manual toggle sets data-theme="light" on html) */
html[data-theme="light"]{
  --bg:#fbfcfe;
  --bg2:#f2f5fa;
  --card:#ffffff;
  --card2:#ffffff;
  --text:#0b1522;
  --muted:#334155;
  --faint:#64748b;
  --line: rgba(2,6,23,.10);
  --accent:#0284c7;
  --accent2:#7c3aed;
  --danger:#e11d48;
  --note:#16a34a;
  --shadow: 0 10px 30px rgba(2,6,23,.08);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
html{ background: var(--bg); }
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

/* Fixed background layer (prevents gradient shifting as the document grows while scrolling) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(167,139,250,.25), transparent 60%),
    radial-gradient(900px 600px at 10% 0%, rgba(125,211,252,.22), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg));
}

a{ color: color-mix(in oklab, var(--accent) 86%, white 14%); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover{ text-decoration-thickness: .12em; }

.skip-link{
  position:absolute;
  top:-200px;
  left:12px;
  padding:10px 12px;
  background: var(--card);
  border:1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--text);
  z-index: 9999;
}
.skip-link:focus{ top:12px; }

/* Progress bar */
.progress{
  position: sticky;
  top:0;
  height: 3px;
  background: transparent;
  z-index: 1000;
}
.progress__bar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* Hero */
.hero{
  padding: 56px 18px 28px;
  border-bottom: 1px solid var(--line);
}
.hero__inner{
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.hero__brand{
  display: inline-flex;
  flex: 0 0 auto;
  text-decoration: none;
}
.hero__content{
  min-width: 0;
}
.hero__logo{
  display:block;
  width: 204px;
  height: 204px;
  max-width: min(204px, 70vw);
  max-height: min(204px, 70vw);
  object-fit: contain;
  margin: 0 0 10px;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.35));
}
.hero__eyebrow{
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
}
.hero__title{
  font-family: var(--serif);
  font-weight: 750;
  letter-spacing: .02em;
  font-size: clamp(36px, 4vw, 58px);
  line-height: 1.05;
  margin: 10px 0 6px;
}
.hero__subtitle{
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  max-width: 70ch;
  margin: 0 0 18px;
}

.art{
  margin: 16px 0 18px;
}
.art img{
  display:block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Mobile hero layout: logo top-centered */
@media (max-width: 700px){
  .hero__inner{
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .hero__logo{
    margin: 0 auto 10px;
    width: 204px;
    height: 204px;
  }
  .hero__actions{
    justify-content: center;
  }
  .hero__meta{
    justify-content: center;
  }
}
.hero__actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  margin: 10px 0 16px;
}
.btn{
  appearance:none;
  border:1px solid var(--line);
  background: color-mix(in oklab, var(--card) 88%, transparent);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 650;
  letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn--primary{
  background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 70%, white 10%), color-mix(in oklab, var(--accent2) 75%, white 8%));
  border-color: transparent;
  color: #051018;
}
.btn--ghost{
  background: transparent;
}

.hero__meta{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pill{
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--card) 84%, transparent);
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.pill strong{ color: var(--text); font-weight: 750; }

/* Layout shell */
.shell{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 18px 70px;
  display:grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items:start;
}

@media (max-width: 980px){
  .shell{ grid-template-columns: 1fr; }
}

/* TOC */
.toc{
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--card) 88%, transparent);
  border-radius: var(--radius2);
  padding: 14px;
  box-shadow: var(--shadow);
}
@media (max-width: 980px){
  .toc{ position: relative; top: 0; }
}
.toc__header{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.toc__title{ font-weight: 800; letter-spacing: .02em; }
.toc__toggle{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 10px;
  cursor:pointer;
}
.toc__toggle:hover{ color: var(--text); }
.toc__nav{
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.toc__nav a{
  display:block;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.toc__nav a:hover{
  color: var(--text);
  background: color-mix(in oklab, var(--card2) 90%, transparent);
  border-color: var(--line);
}
.toc__nav a[aria-current="true"]{
  color: var(--text);
  background: color-mix(in oklab, var(--card2) 90%, transparent);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--line));
}

/* Story */
.content{ min-width: 0; }
.story{
  max-width: var(--max);
}
.section{
  margin: 26px 0;
}
.section h2{
  font-family: var(--serif);
  font-size: clamp(24px, 2.4vw, 34px);
  margin: 18px 0 8px;
}
.story h3{
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 24px);
  margin: 18px 0 8px;
}
.story h4{
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--text);
  letter-spacing: .02em;
}
.story p{
  line-height: 1.75;
  color: color-mix(in oklab, var(--text) 92%, var(--muted) 8%);
  margin: 0 0 12px;
}
.story ul, .story ol{
  line-height: 1.7;
  color: color-mix(in oklab, var(--text) 92%, var(--muted) 8%);
  margin: 8px 0 14px 22px;
}
.story li{ margin: 6px 0; }
.story strong{ color: var(--text); }
.fineprint{
  font-size: 12px;
  color: var(--faint);
}

blockquote{
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid color-mix(in oklab, var(--accent) 60%, var(--line));
  background: color-mix(in oklab, var(--card2) 85%, transparent);
  border-radius: 12px;
}
blockquote p{ margin:0; color: color-mix(in oklab, var(--text) 95%, var(--muted) 5%); }

.rule{
  border: none;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

/* Callouts */
.callout{
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: color-mix(in oklab, var(--card) 90%, transparent);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  margin: 14px 0;
}
.callout h3, .callout h4{
  margin: 0 0 8px;
}
.callout--readaloud{
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--card2) 90%, transparent), color-mix(in oklab, var(--card) 92%, transparent));
  border-color: color-mix(in oklab, var(--accent) 35%, var(--line));
}
.callout--note{ border-color: color-mix(in oklab, var(--note) 35%, var(--line)); }
.callout--danger{ border-color: color-mix(in oklab, var(--danger) 35%, var(--line)); }
.callout--mechanic{ border-color: color-mix(in oklab, var(--accent2) 35%, var(--line)); }
.callout--encounter{ border-color: color-mix(in oklab, var(--accent) 20%, var(--accent2) 20%, var(--line)); }
.callout--loot{ border-color: color-mix(in oklab, var(--note) 20%, var(--accent) 25%, var(--line)); }

/* Cards / grid */
.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.card{
  grid-column: span 12;
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: color-mix(in oklab, var(--card) 92%, transparent);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card h3, .card h4{ margin-top: 0; }

@media (min-width: 820px){
  .card{ grid-column: span 6; }
}

@media (min-width: 1040px){
  .card{ grid-column: span 4; }
}

/* Details */
.details{
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: color-mix(in oklab, var(--card2) 88%, transparent);
  padding: 6px 10px;
  margin-top: 12px;
}
.details summary{
  cursor:pointer;
  font-weight: 800;
  color: var(--text);
  padding: 8px 6px;
}
.details__body{
  padding: 6px 6px 10px;
}
.details--wide{
  padding: 10px 12px;
}

/* Footer */
.footer{
  padding: 30px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.backtotop{
  display:inline-block;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--card) 92%, transparent);
  text-decoration: none;
}

/* Small screen polish */
@media (max-width: 520px){
  .hero{ padding-top: 44px; }
  .pill{ width: 100%; border-radius: 14px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .btn:hover{ transform:none; }
}


