/* hebrewgematriacalculator.com — parchment & lapis */
:root {
  --paper: #f5f0e6; --paper-2: #efe8da; --card: #fffdf8; --ink: #1c1a16; --ink-2: #3a362f; --muted: #6a6357; --line: #e2d9c7; --line-2: #d4c8b1;
  --brand: #1f3b63; --brand-2: #2c5288; --on-brand: #f8f3e8; --accent: #b0741c; --accent-soft: #f4e5c9; --good: #276749; --good-soft: #e3f1e8; --warn-soft: #fbf1dc;
  --focus: #b0741c; --shadow: 0 1px 0 rgba(60, 45, 20, .05), 0 6px 24px -12px rgba(60, 45, 20, .25);
  --serif: 'Frank Ruhl Libre', 'Times New Roman', serif; --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --he: 'Frank Ruhl Libre', 'SBL Hebrew', 'Ezra SIL', 'Times New Roman', serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101318; --paper-2: #151a21; --card: #181d25; --ink: #ece5d6; --ink-2: #d5cdbd; --muted: #a39a89; --line: #2a313b; --line-2: #36404c;
    --brand: #9dbde6; --brand-2: #c0d6f2; --on-brand: #0f1623; --accent: #e3b15f; --accent-soft: #3a2f1c; --good: #8fd3a8; --good-soft: #17301f; --warn-soft: #2e2716;
    --focus: #e3b15f; --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 26px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #101318; --paper-2: #151a21; --card: #181d25; --ink: #ece5d6; --ink-2: #d5cdbd; --muted: #a39a89; --line: #2a313b; --line-2: #36404c;
  --brand: #9dbde6; --brand-2: #c0d6f2; --on-brand: #0f1623; --accent: #e3b15f; --accent-soft: #3a2f1c; --good: #8fd3a8; --good-soft: #17301f; --warn-soft: #2e2716;
  --focus: #e3b15f; --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 26px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.62 var(--sans); overflow-x: hidden; }
a { color: var(--brand-2); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, .h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; color: var(--ink); word-spacing: .06em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.7rem); margin: .2em 0 .35em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .5em; }
h3, .h3 { font-size: 1.18rem; margin: 1.4em 0 .4em; }
p { margin: 0 0 1em; }
.he { font-family: var(--he); font-size: 1.12em; unicode-bidi: isolate; }
bdi[lang="he"] { font-family: var(--he); font-size: 1.1em; }
.lat, .grk { font-family: var(--serif); }
.ar { font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Traditional Arabic', 'Amiri', serif; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; border-radius: 6px; }
.skip:focus { left: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); position: relative; }
.site-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; background: repeating-linear-gradient(90deg, var(--accent) 0 18px, transparent 18px 24px); opacity: .35; }
.site-head .wrap { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.05; }
.brand small { display: block; font-family: var(--sans); font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.nav a { padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.nav a:hover { background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.theme-btn { border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 500 .85rem var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.theme-ico { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, var(--paper) 50%); border: 1px solid var(--ink); }
@media (max-width: 760px) {
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .nav a { white-space: nowrap; padding: 6px 8px; font-size: .9rem; }
  .nav { scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .theme-btn { margin-left: auto; }
}

main { padding: 18px 0 48px; min-width: 0; }
.main-read { max-width: 780px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 8px; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line-2); }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.callout { background: var(--warn-soft); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 8px; }
.note { font-size: .9rem; color: var(--muted); margin: .8em 0 0; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 980px) { .calc-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } .calc-in { position: sticky; top: 12px; } }
.calc-in .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
textarea, input[type="text"], input[type="date"], input[type="number"], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px 12px;
}
textarea#q, input#c { font-family: var(--he); font-size: 1.6rem; line-height: 1.35; resize: vertical; min-height: 2.4em; unicode-bidi: plaintext; }
input#c { font-size: 1.3rem; }
textarea:focus, input:focus, select:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.btn, .toolbar button { font: 500 .92rem var(--sans); border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 7px 14px; cursor: pointer; }
.btn.primary, .toolbar button.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn:hover, .toolbar button:hover { border-color: var(--brand); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.status { min-height: 1.3em; font-size: .88rem; color: var(--good); margin: 6px 0 0; }
.opts { margin-top: 12px; font-size: .9rem; }
.opts summary { cursor: pointer; color: var(--muted); }
.opts .grid2 { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.examples { font-size: .9rem; color: var(--muted); margin-top: 12px; }
.examples a { margin-inline-end: 8px; white-space: nowrap; }

/* keyboard */
.kbd { margin-top: 12px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.kbd-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; font: 500 .8rem var(--sans); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.keys { display: grid; gap: 6px; }
.krow { display: flex; gap: 5px; justify-content: center; flex-wrap: nowrap; }
.key { flex: 1 1 0; min-width: 0; max-width: 52px; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; font-family: var(--he); font-size: 1.35rem; line-height: 1; padding: 0; box-shadow: 0 2px 0 var(--line-2); }
.key small { font: 600 .62rem var(--mono); color: var(--accent); margin-top: 3px; }
.key:active { transform: translateY(1px); box-shadow: none; }
.key.wide { max-width: 220px; flex: 4 1 0; font: 500 .85rem var(--sans); }

/* results */
.results { min-width: 0; }
.rblock { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.res-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; border-bottom: 1px dashed var(--line-2); padding-bottom: 12px; margin-bottom: 14px; }
.res-word .big { font-size: 2.3rem; line-height: 1.2; font-weight: 500; overflow-wrap: anywhere; }
.res-main { text-align: end; }
.res-main .k, .res-hero .k { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.res-main .v { display: block; font-family: var(--serif); font-size: 3.2rem; line-height: 1; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.numlink { display: inline-block; font-size: .85rem; margin-top: 6px; }
.tiles { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tiles.ltr { direction: ltr; }
.tiles li { min-width: 44px; padding: 6px 6px 4px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); text-align: center; display: flex; flex-direction: column; align-items: center; }
.t-l { font-family: var(--he); font-size: 1.55rem; line-height: 1.1; }
.tiles.ltr .t-l { font-family: var(--serif); }
.t-v { font: 600 .74rem var(--mono); color: var(--accent); margin-top: 2px; direction: ltr; }
.methods { width: 100%; border-collapse: collapse; }
.methods th, .methods td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.methods tr:last-child th, .methods tr:last-child td { border-bottom: 0; }
.methods th { text-align: start; font-weight: 600; }
.methods th a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.methods th a:hover { color: var(--brand-2); }
.methods th small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.methods td.num { text-align: end; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.methods tr.more-m td.num { font-size: 1.15rem; color: var(--ink-2); }
.sub-he { display: block; font-size: .95rem; font-weight: 400; color: var(--muted); }
.chain { display: block; font: 500 .8rem var(--mono); color: var(--muted); }
.bd { margin-top: 12px; }
.bd summary, details > summary { cursor: pointer; font-weight: 600; color: var(--brand-2); }
.same { margin-top: 16px; border-top: 1px dashed var(--line-2); padding-top: 4px; }
.same h3 { font-size: 1.05rem; }
.lex { list-style: none; padding: 0; margin: 0; columns: 2 260px; column-gap: 20px; }
.lex li { break-inside: avoid; padding: 3px 0; border-bottom: 1px dotted var(--line); font-size: .92rem; }
.lex .he { font-size: 1.2rem; margin-inline-end: 4px; }
.lex .gl { color: var(--ink-2); }
.lex .sn { color: var(--muted); font: .72rem var(--mono); }
.words { font-size: .95rem; line-height: 1.8; }
.linkish { background: none; border: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r); }
.translit { margin-top: 14px; }
.translit .h3 { margin-top: 0; }
.tag { font: 600 .68rem var(--sans); text-transform: uppercase; letter-spacing: .07em; background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; text-align: start; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip .he { font-size: 1.35rem; }
.chip-v { font: 700 .85rem var(--mono); color: var(--accent); }
.chip-g { grid-column: 1 / -1; font-size: .8rem; color: var(--ink-2); }
.chip-s { grid-column: 1 / -1; font-size: .7rem; color: var(--muted); }
.compare { margin-top: 16px; }
.compare .field { margin-top: 10px; }
.cmp-sum { margin: 10px 0 6px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: start; vertical-align: top; }
.tbl thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--line-2); }
.tbl td.num, .tbl th.num { text-align: end; font-variant-numeric: tabular-nums; }
.tbl tr.total td, .tbl tr.total th { font-weight: 700; border-top: 2px solid var(--line-2); }
.tbl tr.eq td, .tbl tr.eq th { background: var(--good-soft); }
.tbl .he.cell { font-size: 1.4rem; }
.badge { background: var(--good); color: var(--card); font: 700 .7rem var(--sans); padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.diff { color: var(--muted); font-size: .85rem; }

/* date tools */
.tool form { display: grid; gap: 14px; }
.radios { display: flex; gap: 16px; flex-wrap: wrap; }
.hd-big { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; line-height: 1.25; }
.hd-big .hd-he { display: block; font-size: 1.5rem; font-weight: 500; color: var(--ink-2); }
.hd-he { font-family: var(--he); }
.facts { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 600; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 8px; } }
.rev-res { font-size: 1.05rem; }

/* content */
.prose h2 { border-top: 1px solid var(--line); padding-top: 1em; }
.prose h2:first-child { border-top: 0; padding-top: 0; }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li { margin-bottom: .35em; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-inline-start: 3px solid var(--accent); background: var(--paper-2); border-radius: 0 8px 8px 0; }
.prose .he-q { font-family: var(--he); font-size: 1.25rem; direction: rtl; display: block; margin-bottom: 4px; }
.work { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 1em 0; }
.work .eq { font-family: var(--mono); font-size: .9rem; color: var(--ink-2); overflow-wrap: anywhere; }
.sources { font-size: .9rem; color: var(--ink-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 1em 0; padding: 0; list-style: none; }
.cards li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cards a { font-weight: 700; font-family: var(--serif); font-size: 1.1rem; text-decoration: none; }
.cards p { margin: .3em 0 0; font-size: .9rem; color: var(--muted); }
.numgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; list-style: none; padding: 0; }
.numgrid a { display: block; text-align: center; padding: 10px 4px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.numgrid a small { display: block; font: 400 .72rem var(--sans); color: var(--muted); }
.numgrid a.cur { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.numhero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 6px 0 18px; }
.numhero .n { font-family: var(--serif); font-size: 4rem; font-weight: 700; color: var(--brand); line-height: 1; }
.numhero .hn { font-family: var(--he); font-size: 2.2rem; }
.alpha { width: 100%; }
.alpha td .he { font-size: 1.6rem; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 2em; flex-wrap: wrap; }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--paper-2); padding: 28px 0 36px; font-size: .9rem; color: var(--muted); }
.site-foot .cols { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 18px; }
.site-foot h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-family: var(--sans); color: var(--ink-2); margin: 0 0 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 4px; }
.site-foot a { color: var(--ink-2); }
.foot-about strong { color: var(--ink); font-family: var(--serif); font-size: 1.05rem; }
@media (max-width: 860px) { .site-foot .cols { grid-template-columns: 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
.ad-slot:empty { display: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .site-head, .site-foot, .toolbar, .kbd, .theme-btn { display: none; } body { background: #fff; } }
