/* HIC EST — shared styles */
:root {
  --bg: #f3ead4;
  --bg2: #ebe0c4;
  --card: #fbf6e8;
  --ink: #1f2540;
  --ink2: #4a4f68;
  --rust: #a4502f;
  --rust-d: #8a3f22;
  --gold: #c99a42;
  --green: #3e6e66;
  --olive: #717238;
  --blue: #3f5d86;
  --line: #d8c8a0;
  --shadow: 0 2px 0 rgba(31, 37, 64, .08), 0 10px 30px -12px rgba(31, 37, 64, .25);
  --radius: 14px;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: 'Alegreya', Georgia, 'Times New Roman', serif;
  --focus: 0 0 0 3px #f3ead4, 0 0 0 6px #3f5d86;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #14172a;
  --bg2: #1b1f35;
  --card: #20253f;
  --ink: #f0e5c8;
  --ink2: #c3b995;
  --rust: #d9784f;
  --rust-d: #e79068;
  --gold: #dcb35d;
  --green: #79b0a5;
  --olive: #b3b46a;
  --blue: #8eaedb;
  --line: #34395a;
  --shadow: 0 2px 0 rgba(0, 0, 0, .2), 0 12px 30px -12px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px #14172a, 0 0 0 6px #dcb35d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(120, 95, 40, .035) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(120, 95, 40, .035) 3px 4px);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.1rem;
  line-height: 1.55;
  overflow-x: hidden;
}
[data-theme="dark"] body {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, .02) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(255, 255, 255, .02) 3px 4px);
}
img, svg { max-width: 100%; }
a { color: var(--rust); text-underline-offset: 3px; }
a:hover { color: var(--rust-d); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: .02em; }
h1 { font-size: clamp(2rem, 6vw, 3.6rem); margin: .2em 0 .3em; }
h2 { font-size: clamp(1.4rem, 3.6vw, 2.1rem); margin: 0 0 .5em; }
h3 { font-size: 1.15rem; margin: 0 0 .4em; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--ink2); }
.small { font-size: .92rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 14px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px dashed var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: .12em; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; font-family: var(--body); font-weight: 400; font-size: .72rem; letter-spacing: .04em; color: var(--ink2); }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 1rem; }
.nav a:hover { background: var(--bg2); }
.nav a[aria-current="page"] { color: var(--rust); font-weight: 700; box-shadow: inset 0 -2px 0 var(--rust); border-radius: 0; }
.icon-btn { background: none; border: 2px solid var(--line); color: var(--ink); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 1.1rem; display: inline-grid; place-items: center; }
.icon-btn:hover { border-color: var(--rust); }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--card); border-bottom: 2px dashed var(--line); padding: 8px 16px 14px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* ---------- buttons, chips ---------- */
.btn {
  --b: var(--rust);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem var(--body); letter-spacing: .02em;
  padding: 11px 18px; min-height: 44px;
  border-radius: 999px; border: 2px solid var(--b);
  background: var(--b); color: #fff8ea; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--b) 60%, #000);
}
.btn:hover { transform: translateY(-1px); color: #fff8ea; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 60%, #000); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--rust); color: var(--rust); }
.btn.green { --b: var(--green); }
.btn.gold { --b: #a77b26; }
[data-theme="dark"] .btn { color: #14172a; }
[data-theme="dark"] .btn.ghost { color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; min-height: 40px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; cursor: pointer; font: 500 .98rem var(--body);
}
.chip:hover { border-color: var(--rust); }
.chip[aria-pressed="true"], .chip.on { border-color: var(--rust); background: var(--rust); color: #fff8ea; }
[data-theme="dark"] .chip[aria-pressed="true"] { color: #14172a; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stitch-rule { border: 0; height: 0; border-top: 3px dashed var(--rust); opacity: .5; margin: 32px 0; }
.eyebrow { font-family: var(--display); font-size: .8rem; letter-spacing: .25em; color: var(--rust); text-transform: uppercase; font-weight: 700; }
section { padding: 34px 0; }

/* ---------- tapestry viewer ---------- */
.tap-frame {
  position: relative;
  background: #2a2016;
  border-radius: 12px;
  padding: 10px 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), var(--shadow);
}
.tap-scroll {
  overflow-x: auto; overflow-y: hidden;
  scrollbar-color: var(--gold) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.tap-scroll svg { display: block; height: clamp(230px, 46vw, 400px); width: auto; max-width: none; }
.tap-scroll:focus-visible { box-shadow: var(--focus); }
.tap-svg .scn { animation: none; }
.stitching .tap-svg .scn {
  animation: stitchIn .9s cubic-bezier(.4,.1,.3,1) both;
  animation-delay: calc(var(--i) * .32s);
}
@keyframes stitchIn {
  from { clip-path: inset(0 100% 0 0); opacity: .2; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
.tap-hint { position: absolute; right: 12px; bottom: 14px; background: rgba(20,23,42,.75); color: #efe3c4; font-size: .82rem; padding: 4px 10px; border-radius: 99px; pointer-events: none; transition: opacity .4s; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-weight: 700; z-index: 100; transition: transform .3s ease; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.site-foot { border-top: 2px dashed var(--line); padding: 28px 0 40px; margin-top: 40px; color: var(--ink2); font-size: .95rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: space-between; }
.site-foot a { color: var(--ink2); }

/* ---------- forms ---------- */
label { font-weight: 700; }
input[type="text"], textarea, select {
  font: 1.05rem var(--body); color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; box-shadow: var(--focus); }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }

/* ---------- link cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.link-card { display: block; text-decoration: none; color: var(--ink); transition: transform .2s; }
.link-card:hover { transform: translateY(-3px); color: var(--ink); }
.link-card .big { font-size: 2rem; }
.link-card h3 { color: var(--rust); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
