/* =====================================================================
   The Lantern Archive — a night-library theme
   Fonts: Cinzel & EB Garamond (SIL Open Font License), served locally
   ===================================================================== */

@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --night: #0e1120;
  --night-2: #181c31;
  --night-3: #242a45;
  --parchment: #f3e8cc;
  --parchment-2: #e9d9b1;
  --parchment-edge: #cdb582;
  --ink: #2b2016;
  --ink-soft: #5d4b37;
  --gold: #d9b45a;
  --gold-hi: #f1d892;
  --gold-deep: #9c7628;
  --wine: #7b2333;
  --wine-hi: #9a3245;
  --moss: #2e5546;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 10px 30px -12px rgba(0,0,0,.55);
  --display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --body: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--night);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--wine); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--wine-hi); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.no-scroll { overflow: hidden; }

/* ---------- Night sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 32%, #ffe9b8aa 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 41%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 66%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 61% 74%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 86%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 5% 92%, #fff5 50%, transparent 51%),
    radial-gradient(ellipse 60% 45% at 50% 0%, #2c3360 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 110%, #3a2414 0%, transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  background-size: 320px 320px, 410px 410px, 530px 530px, 290px 290px, 370px 370px, 460px 460px, 340px 340px, 390px 390px, 100% 100%, 100% 100%, 100% 100%;
}

/* ---------- Masthead ---------- */
.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.masthead { color: var(--parchment); padding: 1.4rem 0 1rem; }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .9rem; color: var(--gold); text-decoration: none; }
.brand:hover { color: var(--gold-hi); }
.emblem { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 0 10px rgba(217,180,90,.35)); }
.brand-name { display: block; font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: .08em; color: var(--gold-hi); }
.brand-tag { display: block; font-style: italic; font-size: .98rem; color: #cfc3a6; }

.nav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.nav a, .nav-btn {
  font-family: var(--display); font-size: .82rem; letter-spacing: .14em; text-transform: uppercase;
  color: #e6dcc1; text-decoration: none; padding: .5rem .8rem; border-radius: var(--radius);
  background: none; border: 1px solid transparent; cursor: pointer;
}
.nav a:hover, .nav-btn:hover { color: var(--gold-hi); border-color: rgba(217,180,90,.35); }
.nav a[aria-current] { color: var(--gold-hi); border-color: rgba(217,180,90,.6); background: rgba(217,180,90,.08); }
.inline { display: inline; margin: 0; }

/* ---------- Parchment page ---------- */
.main {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.45), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(150,110,50,.18), transparent 50%),
    linear-gradient(var(--parchment), var(--parchment-2));
  border-radius: 4px;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  box-shadow: 0 0 0 1px var(--parchment-edge), 0 0 0 7px rgba(14,17,32,.6), 0 0 0 8px rgba(217,180,90,.45), 0 30px 80px -20px rgba(0,0,0,.8), 0 0 120px rgba(255,190,90,.07);
}
.main::before, .main::after {
  content: "✦"; position: absolute; top: 14px; color: var(--gold-deep); font-size: .9rem; opacity: .7;
}
.main::before { left: 18px; }
.main::after { right: 18px; }
.main > section + section { margin-top: 3.2rem; }

.footer { text-align: center; color: #a99f88; font-style: italic; padding: 2rem 0 3rem; font-size: 1rem; }
.footer p { margin: .3rem 0 0; }
.rule { color: var(--gold-deep); letter-spacing: .6em; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; color: var(--ink); letter-spacing: .03em; }
h2 { font-size: 1.35rem; margin: 0 0 .9rem; }
h3 { font-size: 1.1rem; margin: 0 0 .35rem; }
.display { font-size: clamp(2rem, 5vw, 3.3rem); margin: .2rem 0 .6rem; }
.title { font-size: 1.7rem; margin: 0 0 .6rem; text-align: center; }
.eyebrow { font-family: var(--display); font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--wine); margin: 0; }
.eyebrow a { text-decoration: none; }
.lede { font-size: 1.25rem; color: var(--ink-soft); font-style: italic; max-width: 40rem; }
.small { font-size: .95rem; }
.muted { color: var(--ink-soft); }
.opt { font-weight: 400; font-style: italic; color: var(--ink-soft); font-size: .92em; }
.empty { font-style: italic; color: var(--ink-soft); }
code { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: .92em; }
.prose { max-width: 42rem; }
.prose p:first-child::first-letter {
  font-family: var(--display); float: left; font-size: 3.4em; line-height: .85; padding: .08em .1em 0 0; color: var(--wine);
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 1rem 0 .5rem; }
.hero .lede { margin-inline: auto; }
.hero-stats { display: flex; justify-content: center; align-items: center; gap: 1.6rem; margin-top: 1.4rem; }
.stat { text-decoration: none; color: var(--ink); text-align: center; }
.stat strong { display: block; font-family: var(--display); font-size: 2rem; color: var(--wine); }
.stat span { font-family: var(--display); font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--parchment-edge); margin-bottom: 1.3rem; padding-bottom: .4rem; }
.section-head h2 { margin: 0; }
.section-head a { font-family: var(--display); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.page-head { margin-bottom: 1.8rem; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.6rem; }
.card { position: relative; background: #fbf4e2; border: 1px solid var(--parchment-edge); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 18px 40px -14px rgba(60,30,0,.55); }
.card::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(156,118,40,.35); border-radius: 3px; pointer-events: none; }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-cover { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--night-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.15) saturate(.95); }
.cover-blank { height: 100%; display: grid; place-items: center; color: var(--gold); background: radial-gradient(circle at 50% 40%, var(--night-3), var(--night)); }
.cover-blank .emblem { width: 70px; height: 70px; }
.card-body { padding: 1rem 1.2rem 1.25rem; }
.card-body p { margin: 0 0 .6rem; color: var(--ink-soft); font-size: 1.05rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: .4rem 0 0; }
.tags li { font-family: var(--display); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--moss); border: 1px solid rgba(46,85,70,.4); border-radius: 99px; padding: .15rem .6rem; }

.folio { max-width: 52rem; margin-inline: auto; }
.folio-cover { margin: 1.6rem 0; }
.folio-cover img { width: 100%; border: 10px solid #fbf4e2; outline: 1px solid var(--parchment-edge); box-shadow: var(--shadow); }

/* ---------- Gallery: gilded frames ---------- */
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.4rem; }
.frames-wall { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2rem 1.6rem; }
.frame { margin: 0; text-align: center; }
.frame a {
  display: block; padding: 9px; border-radius: 3px;
  background: linear-gradient(135deg, #7a5a1c, var(--gold-hi) 22%, var(--gold-deep) 45%, var(--gold) 65%, #6d4f17);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 12px 26px -10px rgba(40,20,0,.7);
  transition: transform .2s ease;
}
.frame a:hover { transform: scale(1.025) rotate(-.4deg); }
.frame img { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; border: 3px solid #241809; }
.frame figcaption { font-style: italic; font-size: .98rem; color: var(--ink-soft); margin-top: .55rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem; }
.chips a { font-family: var(--display); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; color: var(--ink); border: 1px solid var(--parchment-edge); padding: .35rem .85rem; border-radius: 99px; background: #fbf4e2; }
.chips a[aria-current] { background: var(--wine); color: var(--parchment); border-color: var(--wine); }

.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; gap: 1rem; background: rgba(8,9,18,.93); padding: 1.5rem; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: min(1200px, 100%); text-align: center; }
.lightbox img { max-height: 82vh; margin: auto; border: 8px solid var(--gold-deep); box-shadow: 0 0 60px rgba(217,180,90,.18); }
.lightbox figcaption { color: var(--parchment); font-style: italic; margin-top: .7rem; }
.lightbox button { background: none; border: 1px solid rgba(217,180,90,.5); color: var(--gold-hi); font-size: 2rem; width: 3rem; height: 3rem; border-radius: 50%; cursor: pointer; flex: none; }
.lightbox button:hover { background: rgba(217,180,90,.12); }
.lb-close { position: absolute; top: 1rem; right: 1rem; }

/* ---------- Forms & buttons ---------- */
.form { display: grid; gap: 1rem; }
.form-wide { max-width: none; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: 1.02rem; }
.form label > .opt { margin-top: -.3rem; }
.form small { font-weight: 400; color: var(--ink-soft); font-size: .9rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); width: 100%;
  background: #fffaf0; border: 1px solid var(--parchment-edge); border-radius: var(--radius);
  padding: .6rem .75rem; box-shadow: 0 1px 2px rgba(80,50,10,.12) inset;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,180,90,.35); }
.check { display: flex !important; align-items: center; gap: .6rem; font-weight: 400 !important; }
.check input { width: auto; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.6rem; letter-spacing: .35em; text-align: center; padding: .7rem; }
.code-input::placeholder { color: #c9b993; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--display); font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink); background: linear-gradient(#fbf4e2, #eadbb5); border: 1px solid var(--parchment-edge);
  border-radius: var(--radius); padding: .7rem 1.2rem; text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 4px rgba(60,30,0,.15);
}
.btn:hover { color: var(--wine); border-color: var(--gold-deep); }
.btn-primary { color: var(--parchment); background: linear-gradient(var(--wine-hi), var(--wine)); border-color: #5a1724; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 14px -4px rgba(123,35,51,.7); }
.btn-primary:hover { color: #fff; background: linear-gradient(#a83a4e, var(--wine-hi)); }
.btn-sm { padding: .35rem .7rem; font-size: .68rem; }
.btn-danger { color: var(--wine); }
.btn-danger:hover { background: var(--wine); color: var(--parchment); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

.drop { position: relative; border: 2px dashed var(--parchment-edge); border-radius: var(--radius); padding: 1.4rem; text-align: center; background: rgba(255,250,240,.6); cursor: pointer; }
.drop:hover { border-color: var(--gold-deep); }
.drop span { font-family: var(--display); letter-spacing: .08em; display: block; }
.drop input { border: none; background: none; box-shadow: none; text-align: center; }

/* ---------- Notices ---------- */
.notice { border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.3rem; border: 1px solid; font-size: 1.05rem; }
.notice-info { background: #efe6d0; border-color: var(--parchment-edge); }
.notice-success { background: #e2ecd9; border-color: #8fae86; color: #24432f; }
.notice-warn { background: #f6e7c1; border-color: var(--gold-deep); color: #5a3e05; }
.notice-error { background: #f5dcd9; border-color: #c28a8a; color: #6b1a22; }

/* ---------- Panels & admin ---------- */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.6rem; margin-bottom: 1.6rem; }
.panel { background: #fbf4e2; border: 1px solid var(--parchment-edge); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.6rem; }
.panels .panel { margin-bottom: 0; }
.panel-glow { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,180,90,.3), var(--shadow); }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--parchment-edge); margin-top: 1rem; }
.tabs a { font-family: var(--display); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); padding: .6rem 1rem; border: 1px solid transparent; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--wine); background: #fbf4e2; border-color: var(--parchment-edge); }
.ledger { width: 100%; border-collapse: collapse; font-size: 1.02rem; }
.ledger th { font-family: var(--display); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; text-align: left; color: var(--ink-soft); border-bottom: 2px solid var(--parchment-edge); padding: .5rem; }
.ledger td { border-bottom: 1px solid rgba(205,181,130,.6); padding: .65rem .5rem; vertical-align: middle; }
.ledger .actions { text-align: right; white-space: nowrap; }
.ledger .actions form, .ledger .actions a { margin-left: .25rem; }
.ledger tr.inactive td { opacity: .55; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid rgba(205,181,130,.6); padding: .6rem 0; }
.admin-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.2rem; }
.admin-photo { background: #fbf4e2; border: 1px solid var(--parchment-edge); border-radius: var(--radius); overflow: hidden; }
.admin-photo img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.admin-photo .form { padding: .8rem; gap: .6rem; }
.admin-photo label { font-size: .9rem; }
.admin-photo input { padding: .4rem .55rem; font-size: 1rem; }

/* ---------- Gate (sign-in) pages ---------- */
.gate { display: flex; min-height: 100vh; }
.gate-main { margin: auto; width: min(470px, 100% - 2rem); padding: 2.5rem 0; }
.gate-brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; color: var(--gold); margin-bottom: 1.4rem; }
.gate-brand .emblem { width: 76px; height: 76px; filter: drop-shadow(0 0 18px rgba(241,216,146,.45)); }
.gate-brand .brand-name { font-size: 1.15rem; }
.scroll {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,255,255,.5), transparent 60%),
    linear-gradient(var(--parchment), var(--parchment-2));
  border-radius: 4px; padding: 2.2rem 2rem 1.6rem;
  box-shadow: 0 0 0 1px var(--parchment-edge), 0 0 0 6px rgba(14,17,32,.7), 0 0 0 7px rgba(217,180,90,.5), 0 30px 70px -10px rgba(0,0,0,.85), 0 0 140px rgba(255,190,90,.12);
}
.scroll .lede { text-align: center; font-size: 1.1rem; margin: 0 auto 1.4rem; }
.gate-foot { text-align: center; color: #9f957d; font-style: italic; font-size: .95rem; margin-top: 1.4rem; }
.gate-foot::before { content: "🔒 "; font-style: normal; }

.steps { list-style: none; display: flex; justify-content: center; gap: .35rem; padding: 0; margin: 1.6rem 0 0; counter-reset: s; flex-wrap: wrap; }
.steps li { counter-increment: s; font-family: var(--display); font-size: .6rem; letter-spacing: .06em; white-space: nowrap; text-transform: uppercase; color: #a89878; display: flex; align-items: center; gap: .35rem; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid currentColor; font-size: .7rem; }
.steps li + li::after { order: -1; content: ""; width: .7rem; height: 1px; background: #cdb58288; }
.steps li.on { color: var(--wine); }
.steps li.done { color: var(--moss); }
.steps li.done::before { content: "✓"; }

.hint { margin: 1.2rem 0 .6rem; background: rgba(255,250,240,.6); border: 1px solid var(--parchment-edge); border-radius: var(--radius); padding: .6rem .9rem; }
.hint summary { cursor: pointer; font-weight: 600; }
.hint p { margin: .5rem 0; }

.qr-wrap { display: flex; justify-content: center; margin: .5rem 0 1rem; }
.qr { width: 220px; height: 220px; padding: 10px; background: #fff; border-radius: 4px; box-shadow: 0 0 0 1px var(--parchment-edge), 0 0 0 6px #fbf4e2, 0 0 0 7px var(--gold-deep), 0 10px 24px -8px rgba(0,0,0,.4); }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { text-align: center; }
.secret code { display: inline-block; background: #fffaf0; border: 1px solid var(--parchment-edge); border-radius: 4px; padding: .5rem .75rem; letter-spacing: .08em; word-break: break-all; }

.codes { columns: 2; padding: 0; list-style: none; background: #fffaf0; border: 1px dashed var(--gold-deep); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; }
.codes li { font-size: 1.15rem; padding: .2rem 0; text-align: center; }

@media (max-width: 640px) {
  body { font-size: 1.08rem; }
  .masthead-inner { justify-content: center; }
  .nav { justify-content: center; }
  .ledger thead { display: none; }
  .ledger tr { display: grid; padding: .4rem 0; border-bottom: 1px solid var(--parchment-edge); }
  .ledger td { border: none; padding: .25rem .2rem; }
  .ledger .actions { text-align: left; }
  .scroll { padding: 1.8rem 1.3rem 1.3rem; }
}

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