/* UnAshamed Tribe V1: tokens, type, shared controls, dialogs */
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500 600; font-display: swap; src: url('../assets/fonts/cormorantgaramond-normal-500.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('../assets/fonts/cormorantgaramond-italic-500.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../assets/fonts/dmsans-normal-400.woff2') format('woff2'); }

:root {
  --ink: #0f1f1d;            /* deepest green-black */
  --night: #142725;          /* page ground */
  --pine: #1c2b29;           /* panels */
  --pine-2: #24393a;         /* raised panels */
  --line: #d1b58d55;         /* hairlines on dark */
  --gold: #f3d29a;           /* accent */
  --gold-deep: #c9a15d;
  --cream: #fbe9c9;          /* primary text on dark */
  --cream-soft: #e6d6b8;     /* secondary text on dark (AA on --pine) */
  --paper: #f6efe2;          /* light reading surface */
  --paper-ink: #2b2118;
  --danger: #ffb4a6;
  --ok: #bfe3b4;
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(.16, .84, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --text-scale: 1;
  color-scheme: dark;
}
:root[data-text='l'] { --text-scale: 1.125; }
:root[data-text='xl'] { --text-scale: 1.25; }

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--cream);
  font: 400 calc(16px * var(--text-scale))/1.55 var(--body); -webkit-font-smoothing: antialiased;
}
body.scroll-page { overflow: auto; height: auto; min-height: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.12; margin: 0; letter-spacing: .005em; }
p { margin: 0; }
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #ffe6bb; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

:focus-visible { outline: 3px solid #ffe2a5; outline-offset: 3px; border-radius: 4px; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 100; background: var(--gold); color: var(--ink); padding: 12px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: calc(12px + var(--safe-t)); }

.eyebrow { font: 500 calc(11px * var(--text-scale))/1.2 var(--body); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border: 1px solid var(--gold); border-radius: 999px; background: transparent; color: var(--cream);
  font: 500 calc(14px * var(--text-scale))/1.2 var(--body); letter-spacing: .02em; text-decoration: none;
  transition: background .25s var(--ease-out), color .25s var(--ease-out), transform .25s var(--ease-out), border-color .25s;
}
.btn:hover { background: #f3d29a22; color: #fff3da; }
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-solid:hover { background: #ffe2b1; color: var(--ink); }
.btn-quiet { border-color: var(--line); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; }
.pill {
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid #f3d29a66; background: #142725e6; color: var(--cream);
  font: 500 calc(13px * var(--text-scale))/1 var(--body); letter-spacing: .03em; backdrop-filter: blur(6px);
  transition: background .25s, border-color .25s, opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.pill:hover { background: #1f3835f2; border-color: var(--gold); }
.chip {
  padding: 9px 14px; border-radius: 8px; border: 1px solid #f3d29a44; background: #142725e6; color: var(--cream);
  font: 500 calc(13px * var(--text-scale))/1.2 var(--body); backdrop-filter: blur(6px);
}

/* ---------- dialogs (native <dialog>) ---------- */
dialog.sheet {
  width: min(680px, calc(100vw - 28px)); max-height: min(86dvh, 860px); padding: 0; border: 1px solid #d1b58d66; border-radius: 18px;
  background: linear-gradient(180deg, #1f3230 0%, #172b29 100%); color: var(--cream); box-shadow: 0 30px 80px #000a; overflow: hidden;
}
dialog.sheet.wide { width: min(940px, calc(100vw - 28px)); }
dialog.sheet::backdrop { background: #08110fbf; backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: sheet-in .38s var(--ease-out); }
dialog.sheet[open]::backdrop { animation: fade-in .38s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet-inner { max-height: inherit; overflow: auto; padding: clamp(22px, 4vw, 40px); overscroll-behavior: contain; }
.sheet h2 { font-size: clamp(30px, 5vw, 44px); margin: 8px 0 10px; }
.sheet .lede { color: var(--cream-soft); max-width: 56ch; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: #142725cc; color: var(--cream); font-size: 22px; line-height: 1; display: grid; place-items: center; z-index: 2;
}
.sheet-close:hover { border-color: var(--gold); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-top: 18px; }
.field label, .field legend { font-weight: 500; font-size: calc(14px * var(--text-scale)); }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 10px; border: 1px solid #d1b58d88; background: #0f1f1dcc; color: var(--cream);
}
.input::placeholder { color: #cdbd9f; opacity: .8; }
.input:focus-visible { outline-offset: 1px; }
textarea.input { min-height: 120px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.check { position: relative; }
.check input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: calc(14px * var(--text-scale)); transition: background .2s, border-color .2s; }
.check input:checked + span { background: #f3d29a2e; border-color: var(--gold); }
.check input:checked + span::before { content: '✓'; margin-right: 6px; color: var(--gold); }
.check input:focus-visible + span { outline: 3px solid #ffe2a5; outline-offset: 2px; }
.form-note { font-size: calc(13px * var(--text-scale)); color: var(--cream-soft); margin-top: 14px; }
.form-status { margin-top: 14px; min-height: 1.5em; font-weight: 500; }
.form-status[data-kind='ok'] { color: var(--ok); }
.form-status[data-kind='err'] { color: var(--danger); }
.hp-field { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- settings rows ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
.setting h3 { font: 500 calc(16px * var(--text-scale))/1.3 var(--body); }
.setting p { color: var(--cream-soft); font-size: calc(14px * var(--text-scale)); }
.switch { position: relative; width: 58px; height: 44px; flex: none; border: 0; background: none; padding: 0; }
.switch::before { content: ''; position: absolute; left: 3px; right: 3px; top: 8px; height: 28px; border-radius: 999px; background: #0f1f1d; border: 1px solid #d1b58d99; transition: background .25s; }
.switch::after { content: ''; position: absolute; left: 7px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--cream-soft); transition: transform .25s var(--ease-out), background .25s; }
.switch[aria-checked='true']::before { background: #c9a15d; }
.switch[aria-checked='true']::after { transform: translateX(24px); background: #fff8e8; }
.seg { display: inline-flex; border: 1px solid #d1b58d88; border-radius: 999px; overflow: hidden; flex: none; }
.seg button { min-width: 48px; min-height: 44px; padding: 8px 14px; border: 0; background: transparent; color: var(--cream); }
.seg button[aria-pressed='true'] { background: var(--gold); color: var(--ink); font-weight: 600; }
input[type='range'] { accent-color: var(--gold); width: min(220px, 40vw); min-height: 44px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(18px + var(--safe-t)); transform: translate(-50%, -20px); z-index: 60; padding: 12px 18px; border-radius: 10px; background: #142725f5;
  border: 1px solid #f3d29a66; opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s var(--ease-out); max-width: calc(100vw - 28px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

#veil { position: fixed; inset: 0; z-index: 30; background: #0c1614; opacity: 0; pointer-events: none; transition: opacity .5s ease; }
#veil.on { opacity: 1; }

.noscript { position: fixed; z-index: 999; inset: auto 12px 12px; background: #1c2927; color: #fff2d8; padding: 18px; border: 1px solid #d1b58d; border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
:root[data-motion='reduce'] *, :root[data-motion='reduce'] *::before, :root[data-motion='reduce'] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
