/* Demo Starter shell — Aquila toss-v2 token primitives, light default + dark. */

:root {
  --bg: #F4F6F8;
  --fg: #161F2C;
  --surface: #FFFFFF;
  --surface-2: #F0F4FB;
  --border: #E2E8F1;
  --accent: #1B64DA;
  --danger: #F04452;
  --accent-hover: #1B64DA;
  --accent-fg: #FFFFFF;
  --accent-soft: #E8F3FF;
  --muted: #4D596A;
  --ring: rgba(34, 114, 235, 0.35);
  --radius-card: 18px;
  --radius-element: 14px;
  --radius-pill: 9999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --font-size-body: 16px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;
  --font-size-title: 28px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 12px 32px -20px rgba(16, 24, 40, 0.35);
  --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", "Segoe UI", sans-serif;
  --shell-max: 1120px;
}

[data-theme="dark"] {
  --bg: #10161F;
  --fg: #E7ECF3;
  --surface: #18202E;
  --surface-2: #1F2939;
  --border: #2A3547;
  --accent: #5B93F0;
  --accent-hover: #77A8F4;
  --accent-fg: #0B1220;
  --accent-soft: rgba(91, 147, 240, 0.16);
  --muted: #97A5BC;
  --ring: rgba(91, 147, 240, 0.45);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -20px rgba(0, 0, 0, 0.7);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: 1.6;
  word-break: keep-all;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ring);
}

.shell-inner {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* Header / footer */

.shell-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.shell-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.demo-notice {
  margin: calc(-1 * var(--space-2)) 0 var(--space-3);
  color: var(--muted);
  font-size: var(--font-size-xs);
  letter-spacing: 0.02em;
}

.shell-main {
  flex: 1;
  padding-block: var(--space-6) var(--space-10);
}

.status {
  min-height: calc(var(--font-size-sm) * 1.6);
  padding-bottom: var(--space-4);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.shell-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.shell-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-4);
}

.return-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -48px;
  z-index: 20;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-element);
  background: var(--accent);
  color: var(--accent-fg);
  transition: top 0.15s ease;
}

.skip-link:focus-visible {
  top: var(--space-2);
}

/* Page structure */

.page-head {
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: var(--font-size-title);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--font-size-sm);
}

/* Primitives */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.muted {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-element);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--fg);
}

.button-secondary:hover {
  background: var(--surface-2);
}

.field {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-element);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

.field::placeholder {
  color: var(--muted);
}

.field:focus {
  border-color: var(--accent);
}

.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.document {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-8);
  overflow-wrap: anywhere;
}

/* Responsive: mobile 390px single column, desktop adaptive up to 1120px */

@media (max-width: 480px) {
  .page-title {
    font-size: calc(var(--font-size-title) - 4px);
  }

  .panel,
  .document {
    padding: var(--space-4);
  }
}

/* Accessibility */

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

/* Print: keep the document, drop navigation, editors and actions */

@media print {
  /* force light document tokens even under data-theme="dark" */
  :root {
    --surface: #FFFFFF;
    --fg: #161F2C;
    --muted: #4D596A;
    --border: #E2E8F1;
  }

  .shell-header,
  .shell-footer,
  .status,
  .skip-link,
  .actions,
  .editor,
  .button {
    display: none !important;
  }

  body {
    background: #FFFFFF;
    color: #000000;
  }

  .shell-main {
    padding: 0;
  }

  .document {
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: none;
  }
}
