/* Torvin Ledgerhand — design tokens and components, transcribed from the
   design handoff. Square corners everywhere, hard card shadows, wood bands. */

:root {
  --ink: #1a1410;
  --walnut: #2a1d14;
  --plank: #3a2919;
  --oak: #6b4a2b;
  --oak-light: #8a6a3a;
  --oak-deep: #5a4224;
  --oak-deeper: #4a3422;
  --parchment: #efe3c8;
  --parchment-dark: #e4d5b3;
  --card: #fbf3df;
  --card-border: #c9b890;
  --rule: #b8a67e;
  --text: #2a1d14;
  --text-2: #5a4a34;
  --muted: #8a7a5a;
  --light: #efe3c8;
  --light-2: #d9c9a4;
  --light-muted: #b8a67e;
  --brass: #d9b56a;
  --ember: #d8641e;
  --ember-hover: #e8843e;
  --ember-dark: #8a3a12;
  --gutter: clamp(20px, 4vw, 48px);
  --display: "IM Fell English SC", serif;
  --display-i: "IM Fell English", serif;
  --label: Cinzel, serif;
  --body: "Crimson Pro", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); font-family: var(--body); color: var(--text); }
a { color: var(--ember-dark); }
a:hover { color: var(--ember); }
p { text-wrap: pretty; }
textarea, input, button { font-family: var(--body); }
button { cursor: pointer; }
img { display: block; }

.page { background: var(--parchment); min-height: 100vh; }
.page-dark { background: var(--ink); min-height: 100vh; }
.wrap { max-width: 1200px; margin: 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- hero / banner ------------------------------------------------------ */
.hero { position: relative; height: min(92vh, 760px); min-height: 560px; overflow: hidden; background: var(--ink); }
.banner { position: relative; height: 360px; overflow: hidden; background: var(--ink); }
.hero img, .banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.banner.pos-10 img { object-position: center 10%; }
.banner.pos-20 img { object-position: center 20%; }
.banner.pos-45 img { object-position: center 45%; }
.banner.pos-60 img { object-position: center 60%; }
.banner.pos-70 img { object-position: center 70%; }
.hero .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,20,16,.4), rgba(26,20,16,0) 35%, rgba(26,20,16,.55) 58%, #1a1410 100%); }
.banner .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,20,16,.5), rgba(26,20,16,.25) 40%, #1a1410 100%); }

.topnav { position: absolute; top: 28px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 0 var(--gutter); z-index: 2; }
.logo { width: 44px; height: 44px; border: 2px solid var(--light); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 22px; color: var(--light); background: rgba(26,20,16,.4); text-decoration: none; flex: none; }
.logo:hover { color: var(--light); }
.nav { display: flex; gap: clamp(16px, 3vw, 34px); flex-wrap: wrap; font-family: var(--label); font-size: 12px; letter-spacing: .22em; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.nav a { color: var(--light); text-decoration: none; padding-bottom: 4px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--light); border-bottom-color: var(--light); }
.nav a.active { border-bottom-color: var(--ember); }

.hero-text { position: absolute; left: 0; right: 0; bottom: 48px; padding: 0 var(--gutter); }
.banner-text { position: absolute; left: 0; right: 0; bottom: 36px; padding: 0 var(--gutter); }
.chip { display: inline-block; font-family: var(--label); font-size: 12px; letter-spacing: .34em; color: var(--brass); background: rgba(26,20,16,.75); padding: 8px 14px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(56px, 9vw, 124px); line-height: .92; color: var(--light); margin: 10px 0 18px; letter-spacing: -.01em; }
.banner h1 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6vw, 80px); line-height: .95; color: var(--light); margin: 10px 0 0; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.hero-bio { max-width: 620px; font-size: 20px; line-height: 1.45; color: var(--light-2); margin: 0; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { font-family: var(--label); font-size: 12px; letter-spacing: .2em; padding: 14px 24px; text-decoration: none; display: inline-block; border: 1px solid transparent; }
.btn-primary { color: var(--ink); background: var(--ember); border-color: var(--ember); }
.btn-primary:hover { background: var(--ember-hover); border-color: var(--ember-hover); color: var(--ink); }
.btn-outline { color: var(--light); border-color: var(--light); }
.btn-outline:hover { background: rgba(239,227,200,.12); color: var(--light); }

/* --- wood band ------------------------------------------------------------ */
.wood { background: repeating-linear-gradient(90deg, #3b2a1d 0 2px, #33241a 2px 9px, #3a2919 9px 15px), var(--plank); border-top: 6px solid var(--oak); border-bottom: 6px solid var(--oak); padding: 22px var(--gutter); }
.wood.tall { padding: 28px var(--gutter); }
.wood.head { border-top: 0; }
.wood-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.wood.tall .wood-row { gap: 24px; }
.wood-title { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.wood-title .t { font-family: var(--display); font-size: 30px; color: var(--light); }
.wood-title .n { font-family: var(--display-i); font-style: italic; font-size: 17px; color: var(--light-muted); }
.wood-progress { font-family: var(--display-i); font-style: italic; font-size: 18px; color: var(--light-2); }
.wood-links { display: flex; gap: clamp(16px, 3vw, 32px); flex-wrap: wrap; font-family: var(--label); font-size: 11px; letter-spacing: .2em; }
.wood-links a { color: var(--light-2); text-decoration: none; }
.wood-links a:hover { color: var(--light); }
.wood-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.wood-btn { font-family: var(--label); font-size: 11px; letter-spacing: .2em; color: var(--light); background: var(--ink); border: 1px solid var(--oak-light); padding: 10px 16px; }
.wood-btn.on { background: var(--oak); }
.wood .logo { background: transparent; }
.wood .nav { text-shadow: none; }

.level { display: flex; align-items: center; gap: 14px; flex: 1 1 320px; max-width: 520px; }
.level-btn { width: 34px; height: 34px; border: 1px solid var(--oak-light); background: var(--ink); color: var(--light); font-size: 20px; padding: 0; line-height: 1; flex: none; }
.level-btn:hover { background: var(--walnut); }
.level-btn[disabled] { cursor: default; opacity: .55; }
.level-mid { flex: 1; }
.level-label { display: flex; justify-content: space-between; font-family: var(--label); font-size: 11px; letter-spacing: .2em; color: var(--brass); margin-bottom: 6px; }
.bar { height: 10px; background: var(--ink); border: 1px solid var(--oak); }
.bar-fill { height: 100%; background: linear-gradient(90deg, #8a3a12, #d8641e); transition: width .3s; }

/* --- parchment sections ---------------------------------------------------- */
.parchment { background: var(--parchment) radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.35), transparent 60%); padding: 48px var(--gutter) 64px; }
.parchment.home { padding: 48px var(--gutter) 56px; background: var(--parchment) radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.35), transparent 60%); }
.parchment.route { padding: 44px var(--gutter) 64px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 48px; }
.grid-2n { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px; }
.grid-2w { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
.stack { display: flex; flex-direction: column; gap: 56px; }
section { scroll-margin-top: 20px; }
.kicker { font-family: var(--label); font-size: 11px; letter-spacing: .28em; color: var(--ember-dark); }
.h2 { font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1.05; margin: 6px 0 14px; color: var(--text); }
.h2.sm { font-size: 32px; }
.h2.gap { margin-bottom: 18px; }
.h2.home { font-size: 34px; line-height: 1.1; margin: 6px 0 18px; }
.h2-row { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.aside { font-family: var(--display-i); font-style: italic; font-size: 17px; color: var(--muted); margin: 0; }
.aside.sm { font-size: 15px; }
.aside.xs { font-size: 14px; }
.aside.mt { margin-top: 14px; }
.aside.mt-sm { margin-top: 12px; }
.body-p { font-size: 17px; line-height: 1.5; color: var(--text-2); margin: 0 0 14px; }
.body-p.max { max-width: 760px; margin-bottom: 18px; }
.body-p.last { margin-bottom: 0; }

.hairlines { display: flex; flex-direction: column; border-top: 1px solid var(--rule); font-size: 17px; line-height: 1.5; color: var(--text); }
.hairlines > div { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.hairlines.tight > div { padding: 12px 0; }
.lead { font-family: var(--display); font-weight: 400; font-size: 20px; }

/* --- cards -------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--card-border); padding: 16px 18px; box-shadow: 2px 3px 0 var(--rule); }
.card.flat { box-shadow: none; position: relative; }
.card.lg { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.card.section { padding: 36px clamp(20px, 3vw, 40px); }
.card.facts { padding: 22px 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.cards { display: flex; flex-direction: column; gap: 14px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cards-grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head.top { align-items: flex-start; }
.card-title { font-family: var(--display); font-size: 21px; color: var(--text); line-height: 1.1; }
.card-title.lg { font-size: 22px; }
.card-meta { font-size: 15px; color: var(--text-2); margin-top: 4px; }
.card-kicker { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--ember-dark); }
.card-text { font-size: 16px; line-height: 1.45; color: var(--text-2); }
.card-text.lh { line-height: 1.5; margin-top: 6px; }
.status { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--light); padding: 4px 9px; border: 0; flex: none; display: inline-block; line-height: normal; }
button.status { cursor: pointer; }
button.status:hover { filter: brightness(1.12); }
span.status { cursor: default; }
.fact-k { font-family: var(--label); font-size: 10px; letter-spacing: .28em; color: var(--ember-dark); }
.fact-v { font-family: var(--display); font-size: 24px; margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-content: start; }
.tile { border: 1px solid var(--card-border); padding: 14px 16px; background: var(--parchment); }
.tile-t { font-family: var(--display); font-size: 20px; }
.tile-t small { font-size: 14px; color: var(--muted); font-family: var(--display); }
.tile-p { font-size: 15px; line-height: 1.45; color: var(--text-2); margin-top: 4px; }

/* --- checkbox rows ------------------------------------------------------------ */
.list { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.row { display: flex; gap: 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.check { width: 18px; height: 18px; border: 2px solid var(--oak); background: transparent; flex: none; display: flex; align-items: center; justify-content: center; color: var(--light); font-size: 13px; padding: 0; line-height: 1; }
.check.lg { width: 20px; height: 20px; }
.check.current { border-color: var(--ember-dark); }
.check.done { background: var(--oak); border-color: var(--oak); }
span.check { cursor: default; }
form.inline { display: contents; }
.row .name { font-size: 18px; color: var(--text); }
.row.done .name { color: var(--text-2); text-decoration: line-through; }
.row.current .name { font-weight: 600; }
.row .kind { margin-left: auto; font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--muted); text-align: right; flex: none; }
.row.current .kind { color: var(--ember-dark); }
.link-more { display: inline-block; margin-top: 18px; font-family: var(--label); font-size: 11px; letter-spacing: .22em; color: var(--ember-dark); text-decoration: none; border-bottom: 1px solid var(--ember-dark); }
.link-more:hover { color: var(--ember); border-color: var(--ember); }

/* --- route page ------------------------------------------------------------------ */
.route-intro { font-family: var(--display-i); font-style: italic; font-size: 17px; color: var(--muted); margin: 0 0 20px; }
.route-list { border-top: 2px solid var(--text); }
.route-row { display: grid; grid-template-columns: 28px 90px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.route-row.current { background: rgba(216,100,30,.07); }
.route-row .check { margin-top: 4px; }
.route-lv { font-family: var(--label); font-size: 13px; letter-spacing: .06em; color: var(--ember-dark); padding-top: 5px; white-space: nowrap; }
.route-row.done .route-lv { color: var(--muted); }
.route-main { min-width: 0; }
.route-name { font-family: var(--display); font-size: 24px; line-height: 1.15; color: var(--text); }
.route-row.done .route-name { color: var(--muted); text-decoration: line-through; }
.route-text { font-size: 17px; line-height: 1.5; color: var(--text-2); margin: 6px 0 0; max-width: 760px; }
.route-row.done .route-text { color: var(--muted); }
.route-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
.tag { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--oak); border: 1px solid var(--oak); padding: 3px 8px; white-space: nowrap; }
.route-row.done .tag { color: var(--muted); border-color: var(--muted); }
.tag.fill { color: var(--light); background: var(--muted); border-color: var(--muted); }
.tag.here { color: var(--light); background: var(--ember-dark); border-color: var(--ember-dark); }
.route-list.hide-optional .route-row.optional { display: none; }
.route-list.hide-details .route-text { display: none; }
@media (max-width: 560px) {
  .route-row { grid-template-columns: 28px minmax(0, 1fr); }
  .route-lv { grid-column: 2; padding-top: 0; }
  .route-main { grid-column: 2; }
  .route-tags { grid-column: 2; justify-content: flex-start; }
}

/* --- trading page ----------------------------------------------------------------- */
.tl { border-top: 1px solid var(--rule); }
.tl-row { display: grid; grid-template-columns: 24px 120px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.tl-row .check { margin-top: 3px; }
.tl-when { font-family: var(--label); font-size: 12px; letter-spacing: .1em; color: var(--ember-dark); padding-top: 4px; }
.tl-text { font-size: 17px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.tl-row.done .tl-text { color: var(--muted); text-decoration: line-through; }
@media (max-width: 480px) {
  .tl-row { grid-template-columns: 24px minmax(0, 1fr); }
  .tl-text { grid-column: 2; }
}
.ranked { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.ranked li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 17px; align-items: baseline; }
.ranked .n { font-family: var(--display); font-size: 20px; color: var(--muted); }
.ranked li.top .n { color: var(--ember-dark); }
.ranked li.top span:last-child { font-weight: 600; }

/* --- journal ------------------------------------------------------------------------- */
.journal-band { background: var(--parchment-dark); border-top: 1px solid var(--card-border); padding: 48px var(--gutter) 64px; }
.journal-intro { font-size: 17px; line-height: 1.5; color: var(--text-2); margin: 0 0 16px; }
.entry-box { width: 100%; background: var(--card); border: 1px solid var(--rule); padding: 14px; font-size: 17px; line-height: 1.45; color: var(--text); resize: vertical; }
.entry-box:focus, .input:focus { outline: 2px solid var(--ember-dark); outline-offset: 0; }
.compose-row { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.compose-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-family: var(--label); font-size: 10px; letter-spacing: .28em; color: var(--ember-dark); }
.input { background: var(--card); border: 1px solid var(--rule); padding: 8px 10px; font-size: 16px; color: var(--text); min-width: 120px; }
.btn-wood { font-family: var(--label); font-size: 11px; letter-spacing: .2em; color: var(--light); background: var(--oak); padding: 12px 20px; border: 0; text-decoration: none; display: inline-block; }
.btn-wood:hover { background: var(--ember-dark); color: var(--light); }
.btn-wood.ghost { background: transparent; color: var(--oak); border: 1px solid var(--oak); padding: 11px 19px; }
.btn-wood.ghost:hover { background: var(--oak); color: var(--light); }
.count { font-family: var(--display-i); font-style: italic; color: var(--muted); font-size: 15px; }
.entries { display: flex; flex-direction: column; gap: 12px; }
.entry-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.entry-date { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--ember-dark); }
.entry-tools { display: flex; gap: 12px; align-items: baseline; }
.entry-tools a { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--muted); text-decoration: none; }
.entry-tools a:hover { color: var(--ember-dark); }
.entry-x { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 0; line-height: 1; }
.entry-x:hover { color: var(--ember-dark); }
.entry-body { font-size: 17px; line-height: 1.5; color: var(--text); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { border: 1px dashed var(--rule); padding: 28px; text-align: center; font-family: var(--display-i); font-style: italic; font-size: 17px; color: var(--muted); }

/* --- legal / plain pages ----------------------------------------------------------- */
.plain { padding: 56px var(--gutter) 72px; }
.plain-inner { max-width: 720px; margin: 0 auto; }
.plain h1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1; margin: 8px 0 28px; }
.plain-body { font-size: 18px; line-height: 1.6; display: flex; flex-direction: column; gap: 18px; }
.plain-body p { margin: 0; }
.plain-body h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 14px 0 -6px; }
.form-card { max-width: 480px; }
.form-card .field + .field { margin-top: 14px; }
.form-card .input { width: 100%; }
.form-err { border: 1px solid var(--ember-dark); background: rgba(216,100,30,.08); padding: 12px 14px; font-family: var(--display-i); font-style: italic; color: var(--ember-dark); margin-bottom: 16px; }

/* --- owner badge -------------------------------------------------------------------- */
.owner-badge { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; gap: 14px; align-items: center; background: var(--walnut); border: 1px solid var(--oak); padding: 9px 12px; font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--brass); box-shadow: 2px 3px 0 rgba(0,0,0,.35); }
.owner-badge a, .owner-badge button { font-family: var(--label); font-size: 10px; letter-spacing: .2em; color: var(--light-2); background: none; border: 0; padding: 0; text-decoration: none; }
.owner-badge a:hover, .owner-badge button:hover { color: var(--light); }

/* --- footer ---------------------------------------------------------------------------- */
.footer { background: var(--walnut); border-top: 8px solid var(--oak); padding: 64px var(--gutter) 28px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-end; justify-content: space-between; }
.footer-left { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 40px; }
.footer-name { font-family: var(--display); font-size: clamp(48px, 7vw, 104px); line-height: .95; color: var(--light); letter-spacing: -.01em; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 28px; max-width: 640px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-h { font-family: var(--label); font-size: 10px; letter-spacing: .3em; color: var(--brass); margin-bottom: 4px; }
.footer-col a { font-size: 17px; color: var(--light-2); text-decoration: none; }
.footer-col a:hover { color: var(--light); }
.footer-note { font-family: var(--display-i); font-style: italic; font-size: 15px; color: var(--muted); line-height: 1.5; }
.footer-art { flex: 0 1 360px; min-width: 240px; width: 100%; aspect-ratio: 3 / 2; }
.footer-art svg { width: 100%; height: 100%; display: block; }
.footer-bar { border-top: 1px solid var(--oak-deeper); margin-top: 44px; padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 28px; font-family: var(--label); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.footer-bar .links { display: flex; gap: 28px; flex-wrap: wrap; }
.footer-bar a { color: var(--light-muted); text-decoration: none; }
.footer-bar a:hover { color: var(--light); }
