/* sitenetsoft.org — hand-crafted, no build step.
   Order: tokens → base → layout → components → motion. */

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;

  /* primitive */
  --blue-logo: #2183c5;

  /* semantic — light */
  --color-bg: #f6f9fb;
  --color-surface: #ffffff;
  --color-text: #16222c;
  --color-muted: #51626f;
  --color-accent: #1a6aa2; /* logo blue darkened for AA on light bg */
  --color-line: #dce4ea;

  --dot-experimental: #b97a1c;
  --dot-progress: var(--blue-logo);
  --dot-upcoming: #8195a1;
  --dot-active: #35855b;

  --pha-hex: #0d1c2c; /* quarkus-pha brand: hexagon stroke, light scheme */

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4.5rem;

  --radius: 0.625rem;
  --measure: 42rem;
  --page-max: 64rem;
}

/* Dark tokens apply when the OS prefers dark and the user hasn't forced light,
   or when the user forces dark via the toggle (data-theme set by assets/js/theme.js,
   persisted in localStorage "pha-color-scheme" — shared with quarkus-pha docs). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0e161d;
    --color-surface: #17222b;
    --color-text: #e6edf3;
    --color-muted: #94a6b3;
    --color-accent: #4da3d9;
    --color-line: #24313c;
    --dot-experimental: #d99a3d;
    --dot-upcoming: #6d8290;
    --dot-active: #4caf7d;
    --pha-hex: #f2f6fa;
  }
}

:root[data-theme="dark"] {
  --color-bg: #0e161d;
  --color-surface: #17222b;
  --color-text: #e6edf3;
  --color-muted: #94a6b3;
  --color-accent: #4da3d9;
  --color-line: #24313c;
  --dot-experimental: #d99a3d;
  --dot-upcoming: #6d8290;
  --dot-active: #4caf7d;
  --pha-hex: #f2f6fa;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.6;
  background: var(--color-bg);
  color: var(--color-text);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-thickness: 2px; }

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

/* ---------- layout ---------- */
.hero,
.section {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding-block: var(--space-6) var(--space-5);
}

.hero-logo {
  width: 7.5rem;
  height: auto;
}

.hero-title {
  margin: var(--space-3) 0 0;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-tagline {
  margin: var(--space-2) 0 0;
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 500;
  color: var(--color-accent);
}

.hero-intro {
  max-width: var(--measure);
  margin: var(--space-4) auto 0;
  color: var(--color-muted);
}

.hero-link {
  display: inline-block;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

/* ---------- sections ---------- */
.section { padding-block: var(--space-5); }

.section-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-note {
  margin: var(--space-2) 0 var(--space-4);
  max-width: var(--measure);
  color: var(--color-muted);
  font-size: 0.9375rem;
}

/* ---------- project cards ---------- */
.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--space-3);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, translate 0.15s ease;
}

.card:hover {
  border-color: var(--color-accent);
  translate: 0 -2px;
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-3) var(--space-3) var(--space-4);
  text-decoration: none;
  color: inherit;
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.card-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-accent);
  overflow-wrap: anywhere;
}

.card-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.card-icon .hex { stroke: var(--pha-hex); }

.card-icon--tile { border-radius: 25%; }

.theme-toggle {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 50%;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* one icon per scheme state; data-theme absent = system */
.theme-toggle svg { display: none; }

:root:not([data-theme]) .theme-toggle .icon-system,
:root[data-theme="light"] .theme-toggle .icon-light,
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }

.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.chip::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--color-muted);
}

.chip[data-status="experimental"]::before { background: var(--dot-experimental); }
.chip[data-status="in-progress"]::before  { background: var(--dot-progress); }
.chip[data-status="upcoming"]::before     { background: var(--dot-upcoming); }
.chip[data-status="active"]::before       { background: var(--dot-active); }

.card-desc {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-muted);
}

/* ---------- family orgs ---------- */
.org-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--space-3);
}

.org-card {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.org-card > div { flex: 1; }

.org-logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 20%;
}

.org-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.org-desc {
  margin: var(--space-2) 0;
  font-size: 0.9375rem;
  color: var(--color-muted);
}

.org-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border-top: 1px solid var(--color-line);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: rise 0.5s ease-out backwards;
  }

  .hero > :nth-child(2) { animation-delay: 0.08s; }
  .hero > :nth-child(3) { animation-delay: 0.16s; }
  .hero > :nth-child(4) { animation-delay: 0.24s; }
  .hero > :nth-child(5) { animation-delay: 0.32s; }

  @keyframes rise {
    from {
      opacity: 0;
      translate: 0 0.75rem;
    }
  }
}
