/* Cursive Lens reference pages: script alphabets, record column guides, the
   decipher tool. Palette and type follow /apps/cursivelens/index.html and the
   app itself: iron-gall navy on aged cream, brass for the one thing that
   matters on a page, oxblood for an honest gap. Light only, like the app.
   The letterforms are the biggest things on a script page; the columns are
   the biggest things on a record page. */

:root {
  --ink: #16233A;
  --ink-2: #3D4B64;
  --ink-3: #727C8E;
  --paper: #F1EBDE;
  --paper-hi: #FBF7EE;
  --rule: #DCD1BC;
  --brass: #B98B4A;
  --brass-hi: #DFBE85;
  --brass-deep: #8A6425;
  --oxblood: #8A2F2A;
  --teal: #2F5D57;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --mono: 'SF Mono', Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(120% 80% at 8% 0%, rgba(185,139,74,.16) 0%, rgba(185,139,74,0) 45%),
    radial-gradient(120% 90% at 95% 5%, rgba(22,35,58,.10) 0%, rgba(22,35,58,0) 50%),
    linear-gradient(170deg,#fdfaf3 0%, #f6f0e4 52%, #f1ebde 100%);
  background-attachment: fixed;
  color: var(--ink-2);
  line-height: 1.6;
}

h1, h2, h3, .serif { font-family: var(--serif); color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.15; margin: 0 0 .75rem; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--brass-deep); }
a:hover { color: var(--ink); }
ul, ol { padding-left: 1.3rem; margin: 0 0 1rem; }
li { margin: .25rem 0; }
small { color: var(--ink-3); }
code, kbd { font-family: var(--mono); font-size: .9em; }

header.bar {
  background: linear-gradient(180deg,#fffdf9 0%, #f8f2e6 100%);
  border-bottom: 1px solid #e6dcc8;
}
.bar-inner {
  max-width: 1040px; margin: 0 auto; padding: .8rem 1rem;
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
}
.bar-inner img { width: 34px; height: 34px; border-radius: 9px; }
.bar-inner a.brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.bar-inner .where { color: var(--ink-3); font-size: .9rem; }
.bar-inner nav { margin-left: auto; display: flex; gap: .9rem; font-size: .88rem; }
.bar-inner nav a { text-decoration: none; color: var(--ink-2); }
.bar-inner nav a[aria-current] { color: var(--brass-deep); font-weight: 600; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 1rem 3rem; }
.crumbs { font-size: .8rem; color: var(--ink-3); padding: .8rem 0 .4rem; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

.kicker { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-deep); font-weight: 700; margin: 1.4rem 0 .4rem; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 46rem; }

/* cards and tiles */
.card { background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 14px; padding: 1.2rem 1.3rem; box-shadow: 0 14px 30px -26px rgba(22,35,58,.5); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 1.2rem 0; }
.tile { display: block; text-decoration: none; color: inherit; background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 14px; padding: 1.1rem 1.2rem; transition: border-color .2s, transform .2s; }
.tile:hover { border-color: var(--brass); transform: translateY(-2px); }
.tile h3 { margin: .2rem 0 .3rem; }
.tile p { margin: 0; font-size: .93rem; color: var(--ink-2); }
.tile .specimen { font-size: 2.6rem; line-height: 1; color: var(--ink); height: 56px; display: flex; align-items: center; }
.tile .specimen { gap: .1rem; }
.tile .specimen img { width: 56px; height: 56px; }

/* facts */
.facts { display: grid; gap: .9rem 1.4rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1.4rem 0; }
.facts dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.facts dd { margin: .25rem 0 0; }

/* alphabet grid */
.alphabet { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); margin: 1rem 0 .6rem; }
.glyph { background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 10px; padding: .4rem .3rem .45rem; text-align: center; text-decoration: none; color: inherit; }
.glyph img { width: 100%; height: auto; aspect-ratio: 1/1; display: block; }
.glyph .face { font-size: 2.9rem; line-height: 1.25; color: var(--ink); display: block; min-height: 3.6rem; }
.glyph .cap { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--ink-2); display: block; margin-top: .15rem; }
.credit { font-size: .82rem; color: var(--ink-3); }
.sample { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.3; color: var(--ink); padding: .6rem 1rem; background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 14px; margin: .8rem 0; overflow-x: auto; }
.face-pinyon { font-family: 'PinyonScript', cursive; }
.face-delafield { font-family: 'MrsSaintDelafield', cursive; }

/* letter notes */
.letters { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .5rem .9rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.letters li { display: grid; grid-template-columns: 64px 1fr; gap: .7rem; align-items: start; background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 10px; padding: .5rem .6rem; }
.letters img { width: 64px; height: 64px; }
.letters b { font-family: var(--serif); color: var(--ink); }
.letters span { font-size: .92rem; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper-hi); margin: .8rem 0 1.2rem; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
caption { text-align: left; padding: .7rem .9rem .2rem; font-size: .85rem; color: var(--ink-3); }
th, td { text-align: left; padding: .55rem .8rem; border-top: 1px solid var(--rule); vertical-align: top; }
thead th { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-top: none; }
tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
td.num { font-family: var(--mono); color: var(--ink-3); }
.gap { color: var(--oxblood); font-style: italic; }

/* abbreviations */
.abbr { list-style: none; padding: 0; margin: .4rem 0 1rem; columns: 2; column-gap: 1.6rem; }
.abbr li { break-inside: avoid; font-size: .93rem; padding: .18rem 0; border-bottom: 1px dotted var(--rule); }
.abbr b { font-family: var(--mono); color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .abbr { columns: 1; } }

/* the tool */
.tool { background: var(--paper-hi); border: 1px solid var(--rule); border-radius: 16px; padding: 1.2rem; margin: 1.2rem 0; box-shadow: 0 18px 40px -30px rgba(22,35,58,.6); }
.tool-band { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brass-deep); font-weight: 700; margin-bottom: .6rem; }
.field { margin: .7rem 0; }
.field label, .field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink); margin-bottom: .3rem; }
select, textarea, input[type=text] { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 9px; padding: .55rem .7rem; }
textarea { min-height: 7rem; font-family: var(--mono); font-size: .88rem; line-height: 1.5; }
.btn { display: inline-block; padding: .68rem 1.2rem; border-radius: 10px; border: none; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.btn-primary { background: linear-gradient(135deg, #16233A 0%, #22344f 100%); color: #f6efe2; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(22,35,58,.32); }
.btn-primary[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn-secondary { background: transparent; border: 2px solid #c9ab77; color: var(--brass-deep); }
.btn-secondary:hover { background: rgba(185,139,74,.10); }
.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin: .8rem 0 .2rem; }
.result { margin-top: 1rem; }
.note { font-size: .85rem; color: var(--ink-3); }
.warning { background: rgba(138,47,42,.06); border: 1px solid rgba(138,47,42,.28); border-radius: 12px; padding: .9rem 1.1rem; margin: 1rem 0; color: var(--ink-2); }
.warning strong { color: var(--oxblood); }

/* decipher tool */
.drop { display: block; border: 2px dashed var(--rule); border-radius: 14px; padding: 1.3rem; text-align: center; background: #fff; cursor: pointer; }
.drop.over { border-color: var(--brass); background: rgba(185,139,74,.08); }
.drop input { display: none; }
.cropper { position: relative; margin: .8rem 0; max-width: 100%; overflow: hidden; border-radius: 12px; border: 1px solid var(--rule); background: #fff; touch-action: none; user-select: none; }
.cropper canvas { display: block; max-width: 100%; height: auto; }
.cropper .box { position: absolute; border: 2px solid var(--brass); box-shadow: 0 0 0 9999px rgba(22,35,58,.38); pointer-events: none; }
.preview { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }
.preview canvas { border: 1px solid var(--rule); border-radius: 8px; background: #fff; max-width: 100%; height: auto; }
.candidates { list-style: none; padding: 0; margin: .6rem 0 0; }
.candidates li { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; align-items: baseline; padding: .7rem .2rem; border-top: 1px solid var(--rule); }
.candidates .reading { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); }
.candidates .conf { font-family: var(--mono); font-size: .75rem; color: var(--brass-deep); }
.candidates .why { grid-column: 1 / -1; font-size: .9rem; color: var(--ink-2); }
.meter { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; grid-column: 1 / -1; }
.meter i { display: block; height: 100%; background: var(--brass); }

/* cta + footer */
.cta { background: linear-gradient(160deg,#16233A 0%, #22344f 100%); color: #efe6d5; border-radius: 22px; padding: 1.8rem 1.6rem; margin: 2.6rem 0 1.4rem; box-shadow: 0 30px 50px -28px rgba(22,35,58,.7); }
.cta h2 { color: #fff; margin: 0 0 .5rem; }
.cta p { color: #d7cfbf; }
.cta .btn-primary { background: #DFBE85; color: #16233A; }
.cta .btn-row a.alt { color: #DFBE85; text-decoration: underline; }
.related { margin: 1.6rem 0; }
.related ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.related li a { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper-hi); text-decoration: none; font-size: .88rem; color: var(--ink-2); }
.related li a:hover { border-color: var(--brass); color: var(--ink); }
dl.faq dt { font-weight: 700; color: var(--ink); margin-top: 1rem; }
dl.faq dd { margin: .3rem 0 0; }
footer { text-align: center; padding: 1.8rem 1rem 2.4rem; font-size: .85rem; color: var(--ink-3); border-top: 1px solid #e6dcc8; background: linear-gradient(180deg,#f8f2e6,#f1ebde); }
footer a { color: var(--ink-2); text-decoration: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  .bar-inner nav { margin-left: 0; width: 100%; }
  tbody th { white-space: normal; min-width: 7rem; }
  td:not(.num) { min-width: 10rem; }
  .letters li { grid-template-columns: 56px 1fr; }
  .alphabet { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
}
