/*
 * OpenOrgOS public design system
 * Canonical tokens for oorgos.org (Vercel) and community.oorgos.org (Next.js).
 * Keep product-specific layout rules in each application; do not redefine these
 * foundation tokens there.
 */
:root {
  color-scheme: light;

  /* Neutral-first palette: one brand accent plus semantic status colors. */
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --background: #ffffff;
  --foreground: var(--ink);
  --muted: var(--ink-soft);
  --surface: #f5f5f7;
  --surface-elevated: #ffffff;
  --surface-muted: var(--section-alt);
  --section-alt: #eef1f6;
  --hero-bg: var(--section-alt);
  --hero-text: var(--ink);
  --hero-muted: var(--ink-soft);
  --hero-glow-1: rgba(0, 113, 227, 0.18);
  --hero-glow-2: rgba(0, 51, 102, 0.12);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0068d1;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --on-accent: #ffffff;
  --success: #18794e;
  --warning: #9a6700;
  --danger: #b42318;
  --header-bg: rgba(245, 245, 247, 0.72);
  --frost-bg: rgba(255, 255, 255, 0.92);
  --text: var(--ink);

  /* Compatibility aliases. New UI should use ink/accent/surface tokens. */
  --navy: var(--ink);
  --navy-deep: var(--ink);
  --lf-navy: var(--ink);
  --ink-muted: var(--ink-soft);
  --surface-raised: var(--surface-elevated);
  --alt-section: var(--section-alt);
  --surface-alt: var(--section-alt);
  --border-emphasis: var(--border-strong);
  --accent-muted: var(--accent-soft);

  --font-sans: var(--font-instrument, "Instrument Sans"), "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: var(--font-newsreader, "Newsreader"), Georgia,
    "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* A deliberately small type scale. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: clamp(1.75rem, 4vw, 2.25rem);
  --text-display: clamp(2.5rem, 7vw, 4.5rem);

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --leading-body: 1.55;
  --leading-heading: 1.15;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-9: 56px;
  --space-10: 64px;
  --page-gutter: var(--space-5);
  --page-gutter-sm: var(--space-4);
  --grid-gap: var(--space-5);
  --max-width: 1140px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --control-height: 44px;
  --control-height-sm: 36px;
  --control-height-lg: 48px;
  --control-padding-x: 1.375rem;
  --control-padding-y: 0.75rem;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --shadow-soft: 0 20px 48px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-action: 0 8px 24px rgba(0, 113, 227, 0.2);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --ink: #f5f5f7;
  --ink-soft: #a1a1a6;
  --background: #000000;
  --foreground: var(--ink);
  --muted: var(--ink-soft);
  --surface: #1c1c1e;
  --surface-elevated: #2c2c2e;
  --section-alt: #000000;
  --surface-muted: var(--section-alt);
  --hero-bg: var(--surface);
  --hero-text: var(--ink);
  --hero-muted: var(--ink-soft);
  --hero-glow-1: rgba(10, 132, 255, 0.22);
  --hero-glow-2: rgba(10, 132, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.2);
  --on-accent: #ffffff;
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --header-bg: rgba(28, 28, 30, 0.82);
  --frost-bg: rgba(44, 44, 46, 0.92);
  --text: var(--ink);
  --navy: var(--ink);
  --navy-deep: var(--ink);
  --lf-navy: var(--ink);
  --ink-muted: var(--ink-soft);
  --surface-raised: var(--surface-elevated);
  --alt-section: var(--section-alt);
  --surface-alt: var(--section-alt);
  --border-emphasis: var(--border-strong);
  --accent-muted: var(--accent-soft);
  --shadow-soft: 0 20px 48px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-action: 0 8px 24px rgba(10, 132, 255, 0.28);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

button,
input,
select,
textarea {
  font: inherit;
}

.btn {
  min-height: var(--control-height);
  padding: var(--control-padding-y) var(--control-padding-x);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.btn-sm {
  min-height: var(--control-height-sm);
  padding: 0.45rem 1rem;
  font-size: var(--text-sm);
}

.btn-lg {
  min-height: var(--control-height-lg);
  padding: 0.875rem 1.5rem;
  font-size: var(--text-base);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: var(--shadow-action);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

.btn-outline {
  background: var(--surface-elevated);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: none;
}

.btn-ghost,
.btn-outline-light {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  :root {
    --page-gutter: var(--page-gutter-sm);
  }
}

html {
  background: var(--surface);
  color-scheme: light dark;
}

/* Public chrome — shared by oorgos.org pages. Community layout overrides live in globals.css. */
.site-header {
  --header-height: 52px;
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner,
.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-height);
}

.brand {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

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

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-nav a {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  line-height: 1.15;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.header-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

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

.lang-select-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: var(--weight-semibold);
  color: var(--ink-soft);
  white-space: nowrap;
}

.lang-select {
  min-width: 7.5rem;
  padding: 0.375rem 1.75rem 0.375rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--frost-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

html[data-theme="dark"] .lang-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1a6' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
}

.theme-picker {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-picker-legend {
  padding: 0;
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

.theme-picker-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  cursor: pointer;
}

.theme-picker-option:hover {
  border-color: var(--border-strong);
}

.theme-picker-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-picker-option input {
  margin: 0;
  accent-color: var(--accent);
}

.theme-picker-swatch {
  width: 72px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.theme-picker-swatch.is-light {
  background: linear-gradient(180deg, #eef1f6, #f5f5f7);
}

.theme-picker-swatch.is-dark {
  background: linear-gradient(180deg, #2c2c2e, #1c1c1e);
}

.theme-picker-swatch.is-system {
  background: linear-gradient(90deg, #f5f5f7 50%, #1c1c1e 50%);
}

.theme-picker-copy {
  display: grid;
  gap: var(--space-1);
}

.theme-picker-copy strong {
  font-size: var(--text-sm);
  color: var(--ink);
}

.theme-picker-copy span {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  line-height: 1.45;
}

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