/* Yonder Seal styles. Dark by default; [data-theme=light] is a genuinely light theme. */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-elev: #111a2e;
  --surface: #131d33;
  --surface-2: #1a2540;
  --border: #2a3756;
  --text: #e6ebf5;
  --text-muted: #a3b0c8;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-ink: #04201c;
  --primary-bg: #14b8a6;
  --primary-bg-hover: #2dd4bf;
  --primary-text: #04201c;
  --primary-border: #14b8a6;
  --secondary-bg: #1a2540;
  --secondary-bg-hover: #22304f;
  --secondary-text: #e6ebf5;
  --danger-bg: #3b1219;
  --danger-bg-hover: #521a24;
  --danger-text: #fecdd3;
  --danger-border: #9f1239;
  --ok: #86efac;
  --err: #fda4af;
  --focus: #fbbf24;
  --switch-track: #334155;
  --switch-track-on: #14b8a6;
  --logo-tile-a: #14b8a6;
  --logo-tile-b: #4f46e5;
  --logo-mark: #ffffff;
  --hero-wash: linear-gradient(180deg, rgba(8, 13, 26, 0.86) 0%, rgba(8, 13, 26, 0.9) 55%, #0b1220 100%);
  --hero-filter: grayscale(20%) brightness(0.8);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-4: 0 20px 50px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(11, 18, 32, 0.92);
}

[data-theme="light"] {
  color-scheme: only light;
  --bg: #f7fafc;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-ink: #0f172a;
  --primary-bg: #ccfbf1;
  --primary-bg-hover: #99f6e4;
  --primary-text: #042f2e;
  --primary-border: #14b8a6;
  --secondary-bg: #f1f5f9;
  --secondary-bg-hover: #e2e8f0;
  --secondary-text: #0f172a;
  --danger-bg: #fee2e2;
  --danger-bg-hover: #fecaca;
  --danger-text: #7f1d1d;
  --danger-border: #f87171;
  --ok: #166534;
  --err: #9f1239;
  --focus: #b45309;
  --switch-track: #cbd5e1;
  --switch-track-on: #5eead4;
  --logo-tile-a: #ccfbf1;
  --logo-tile-b: #e0e7ff;
  --logo-mark: #134e4a;
  --hero-wash: linear-gradient(180deg, rgba(247, 250, 252, 0.86) 0%, rgba(247, 250, 252, 0.9) 60%, #f7fafc 100%);
  --hero-filter: grayscale(30%) brightness(1.35) contrast(0.75);
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-4: 0 18px 40px rgba(15, 23, 42, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.94);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  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: 8px;
  top: -48px;
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.skip:focus {
  top: 8px;
}

.muted {
  color: var(--text-muted);
  font-weight: 400;
}

/* ---------- navbar ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.logo-tile {
  fill: var(--logo-tile-a);
}

.logo-ring {
  stroke: var(--logo-mark);
}

.logo-mark {
  fill: var(--logo-mark);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-label {
  font-size: 14px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--switch-track);
  cursor: pointer;
  padding: 0;
  flex: none;
  transition: background-color 0.2s ease;
}

.switch[aria-checked="true"] {
  background: var(--switch-track-on);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.switch[aria-checked="true"] .switch-knob {
  transform: translateX(20px);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 64px 24px 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  z-index: -2;
  filter: var(--hero-filter);
}

.hero-wash {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-wash);
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--text);
}

.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 32px;
  max-width: 64ch;
}

/* ---------- card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-4);
}

.card-title {
  font-size: 22px;
  margin: 0 0 24px;
  line-height: 1.3;
}

.card-title:focus {
  outline: none;
}

.card p {
  margin: 0 0 16px;
}

.field {
  margin: 0 0 24px;
  min-width: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label,
.label {
  display: block;
  font-weight: 600;
  margin: 0 0 8px;
}

.help {
  font-size: 14px;
  color: var(--text-muted);
  margin: 8px 0 0 !important;
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 48px;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

[aria-invalid="true"] {
  border-color: var(--err) !important;
}

.input-with-button {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-button input {
  flex: 1;
  min-width: 0;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-small {
  min-height: 48px;
  padding: 8px 16px;
  font-size: 15px;
}

.btn-wide {
  width: 100%;
}

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-text);
  border-color: var(--primary-border);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-bg-hover);
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg-hover);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.actions-tight {
  margin-top: 12px;
}

/* ---------- files ---------- */

.dropzone {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-2);
}

.dropzone label {
  margin: 0;
}

.dropzone.dragging {
  border-color: var(--accent);
}

.dropzone input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.dropzone-hint {
  color: var(--text-muted);
  font-size: 14px;
}

.file-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-list:empty {
  display: none;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--bg-elev);
  min-width: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-size {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 8px;
}

/* ---------- status and notes ---------- */

.status {
  min-height: 1.6em;
  margin: 12px 0 0 !important;
  font-size: 15px;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}

.note {
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
}

.facts {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text-muted);
}

/* ---------- how it works ---------- */

.section-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.how {
  padding: 64px 0;
}

.how h2 {
  font-size: 30px;
  margin: 0 0 32px;
  line-height: 1.2;
}

.how-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.how-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-1);
}

.how-item h3 {
  font-size: 18px;
  margin: 0 0 8px;
  line-height: 1.3;
}

.how-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 24px 0;
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer p {
  margin: 0;
}

/* ---------- 404 ---------- */

.notfound {
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 24px;
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .how-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .nav-inner {
    padding: 12px 16px;
  }
  .brand {
    font-size: 18px;
  }
  .theme-label {
    font-size: 13px;
  }
  .hero {
    padding: 40px 16px 48px;
  }
  h1 {
    font-size: 28px;
  }
  .lead {
    font-size: 16px;
  }
  .card {
    padding: 20px;
    border-radius: 14px;
  }
  .row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .how-grid {
    grid-template-columns: 1fr;
  }
  .how h2 {
    font-size: 24px;
  }
  .section-inner {
    padding: 0 16px;
  }
}

@media (max-width: 360px) {
  .theme-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Theme changes apply at once (see initTheme in app.ts). */
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}
