/* The Cakana Clan Family Network: shared styles */
:root {
  --bg: #F4EEE2;
  --surface: #FBF8F1;
  --surface-2: #1E3A2F;
  --forest: #1E3A2F;
  --forest-deep: #14271F;
  --text: #262624;
  --muted: #6B655B;
  --accent: #B8924A;
  --accent-rgb: 184, 146, 74;
  --accent-ink: #7D5F27;
  --accent-2: #6B4A32;
  --line: #DCD2C0;
  --ivory: #F4EEE2;
  --danger: #9B2C2C;
  --ok: #2F6B45;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --tshadow: 0 1px 2px rgba(5,10,8,.9), 0 3px 12px rgba(5,10,8,.65), 0 10px 44px rgba(5,10,8,.6);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38,38,36,.06), 0 8px 30px rgba(38,38,36,.07);
  --wrap: 1180px;
  --pad: clamp(16px, 4vw, 40px);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cg fill='none' stroke='%23B8924A' stroke-width='1.2'%3E%3Cpath d='M0 15 8 1 16 15M16 15 24 1 32 15M32 15 40 1 48 15'/%3E%3Cpath d='M24 6l3 3-3 3-3-3z' fill='%23B8924A' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--forest); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.12; margin: 0 0 .5em; color: var(--forest-deep); letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h3 { font-size: clamp(1.35rem, 2.2vw, 1.65rem); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--forest); color: var(--ivory); padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.eyebrow { font: 600 .78rem/1.3 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 14px; display: inline-flex; gap: 10px; align-items: center; }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 62ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 .95rem/1 var(--font); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
  text-shadow: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn--primary { background: linear-gradient(135deg, var(--accent), #C9A863); color: var(--forest-deep); box-shadow: 0 6px 20px rgba(var(--accent-rgb), .28); }
.btn--primary:hover { color: var(--forest-deep); box-shadow: 0 10px 28px rgba(var(--accent-rgb), .36); }
.btn--forest { background: var(--forest); color: var(--ivory); }
.btn--forest:hover { background: var(--forest-deep); color: var(--ivory); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--forest); }
.btn--ghost:hover { border-color: var(--accent); color: var(--forest-deep); }
.btn--light { background: rgba(244,238,226,.12); border-color: rgba(244,238,226,.45); color: var(--ivory); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn--light:hover { background: rgba(244,238,226,.22); color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { color: #fff; background: #7f2222; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: .86rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: 600 .72rem/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; background: rgba(var(--accent-rgb), .14); color: var(--accent-ink); border: 1px solid rgba(var(--accent-rgb), .3); white-space: nowrap; }
.chip--now { background: rgba(47,107,69,.12); color: var(--ok); border-color: rgba(47,107,69,.3); }
.chip--soon { background: rgba(107,74,50,.08); color: var(--accent-2); border-color: rgba(107,74,50,.22); }
.chip--sample { background: #EFE6D4; color: var(--accent-2); border-color: #D8C7A7; }
.chip--danger { background: rgba(155,44,44,.1); color: var(--danger); border-color: rgba(155,44,44,.28); }

/* ---------- emblem ---------- */
.emblem { display: block; color: var(--forest); }
.emblem .e-ring { fill: none; stroke: var(--accent); }
.emblem .e-beads { fill: none; stroke: var(--accent); }
.emblem .e-river { fill: none; stroke: var(--accent); stroke-linecap: round; }
.emblem .e-tree { fill: currentColor; }
.on-dark .emblem, .emblem.on-dark { color: var(--ivory); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--forest-deep); }
.hint { font-size: .82rem; color: var(--muted); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=search], input[type=url], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: 400 1rem/1.4 var(--font);
  transition: border-color .2s ease, box-shadow .2s ease;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .22); }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--forest); flex: none; }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.form-msg { border-radius: 10px; padding: 12px 14px; font-size: .95rem; margin-bottom: 16px; }
.form-msg:empty { display: none; }
.form-msg--error { background: rgba(155,44,44,.08); color: var(--danger); border: 1px solid rgba(155,44,44,.22); }
.form-msg--ok { background: rgba(47,107,69,.08); color: var(--ok); border: 1px solid rgba(47,107,69,.22); }
.form-msg--info { background: rgba(var(--accent-rgb),.1); color: var(--accent-ink); border: 1px solid rgba(var(--accent-rgb),.28); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 2.6vw, 28px); }
.card h3 { margin-bottom: .35em; }

/* ---------- toast ---------- */
.toast-host { position: fixed; z-index: 200; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--forest-deep); color: var(--ivory); padding: 12px 16px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); font-size: .95rem; animation: toast-in .3s ease both; pointer-events: auto; border-left: 4px solid var(--accent); }
.toast--error { border-left-color: #E07B7B; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- auth pages (apply, login, reset, status) ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--bg); }
@media (min-width: 980px) { .auth-page { grid-template-columns: minmax(380px, 44%) 1fr; } }
.auth-aside { position: relative; color: var(--ivory); padding: 28px var(--pad); display: flex; flex-direction: column; justify-content: space-between; gap: 30px; min-height: 260px; overflow: hidden; background: var(--forest-deep); }
.auth-aside::before { content: ""; position: absolute; inset: 0; background: url("../assets/img/story-stream.jpg") center / cover no-repeat; opacity: .5; }
.auth-aside--river::before { background-image: url("../assets/img/hero-river.jpg"); }
.auth-aside--canyon::before { background-image: url("../assets/img/canyon.jpg"); }
.auth-aside::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,39,31,.55), rgba(20,39,31,.88)); }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h1, .auth-aside h2 { color: var(--ivory); text-shadow: var(--tshadow); }
.auth-aside p { color: rgba(244,238,226,.86); }
.auth-aside .motto { font-family: var(--font-head); font-style: italic; font-size: 1.25rem; color: #E6D3AC; }
@media (max-width: 979px) { .auth-aside { min-height: 0; padding-bottom: 32px; } .auth-aside .aside-body { display: none; } }
.auth-main { padding: clamp(28px, 6vw, 72px) var(--pad); display: flex; justify-content: center; }
.auth-panel { width: 100%; max-width: 560px; }
.auth-panel h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.brand-link { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-link:hover { color: inherit; }
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; line-height: 1.1; }
.brand-name small { display: block; font-family: var(--font); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; opacity: .8; font-weight: 600; }
.steps-mini { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps-mini li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.steps-mini .n { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(230,211,172,.6); display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: #E6D3AC; }
.fieldset { border: 0; padding: 0; margin: 0 0 8px; }
.fieldset legend { font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; color: var(--forest-deep); margin-bottom: 12px; padding: 0; }
.divider-pattern { height: 16px; background: var(--pattern) repeat-x center / auto 12px; opacity: .55; margin: 26px 0; }

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

/* ---------- utilities shared by auth and app pages ---------- */
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.avatar { --s: 48px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, #2C5242, var(--forest)); color: #E6D3AC; font: 600 calc(var(--s) * .36)/1 var(--font); letter-spacing: .02em; box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .55); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.status-steps { list-style: none; padding: 0; margin: 26px 0; display: grid; gap: 0; }
.status-steps li { position: relative; padding: 0 0 22px 44px; display: grid; gap: 2px; }
.status-steps li::before { content: ""; position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.status-steps li::after { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.status-steps li:last-child::after { display: none; }
.status-steps li span { color: var(--muted); font-size: .95rem; }
.status-steps li.is-done::before { background: var(--forest) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6D3AC' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 14px no-repeat; border-color: var(--forest); }
.status-steps li.is-done::after { background: var(--forest); }
.status-steps li.is-current::before { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(var(--accent-rgb), .2); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb), .08); } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
@media (min-width: 980px) { .auth-aside { position: sticky; top: 0; height: 100vh; } }
