/* ==========================================================================
   xopen — Apple-inspired design system
   Light-first, automatic dark. System (SF Pro) type. No external fonts.
   Restyles the site's existing semantic classes so page markup stays lean.
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, monospace;

  /* Light palette */
  --canvas: #fbfbfd;
  --canvas-2: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #494951;
  --muted: #6e6e73;
  --hairline: rgba(0, 0, 0, 0.10);
  --hairline-2: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-ink: #0066cc;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 20px 44px rgba(0, 0, 0, 0.09);
  --nav-bg: rgba(251, 251, 253, 0.72);
  --tint-a: rgba(0, 113, 227, 0.14);
  --tint-b: rgba(120, 80, 220, 0.10);

  --max: 1120px;
  --radius: 20px;
  --radius-lg: 28px;
  --nav-h: 52px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #000000;
    --canvas-2: #0a0a0c;
    --surface: #16161a;
    --surface-2: #1d1d20;
    --ink: #f5f5f7;
    --ink-2: #c7c7cc;
    --muted: #86868b;
    --hairline: rgba(255, 255, 255, 0.12);
    --hairline-2: rgba(255, 255, 255, 0.07);
    --accent: #2997ff;
    --accent-ink: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.5), 0 28px 60px rgba(0, 0, 0, 0.55);
    --nav-bg: rgba(10, 10, 12, 0.66);
    --tint-a: rgba(41, 151, 255, 0.18);
    --tint-b: rgba(150, 110, 255, 0.14);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--canvas);
}

body,
body.cinematic-page {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Neutralize the old cinematic video background if any page still ships it. */
.cinematic-bg { display: none !important; }

a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-soft); color: var(--ink); }

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  transition: transform 0.25s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================ Navigation ============================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-2);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.nav-brand b { color: var(--accent); font-weight: 600; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 450;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 550; }

.nav-side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 4px;
  border-radius: 999px;
}
.nav-lang a {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-lang a:hover { color: var(--ink); }
.nav-lang a[aria-current="true"] { color: var(--ink); background: var(--surface-2); }

.nav-cta,
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 17px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 550;
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.nav-cta:hover,
.button:hover { background: var(--accent-ink); transform: translateY(-1px); }
.nav-cta svg,
.button svg { width: 15px; height: 15px; }

/* ============================ Hero (home) ============================ */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(96px, 16vh, 190px) 0 clamp(80px, 12vh, 140px);
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 120%;
  background:
    radial-gradient(60% 55% at 30% 20%, var(--tint-a), transparent 70%),
    radial-gradient(55% 50% at 78% 30%, var(--tint-b), transparent 72%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.eyebrow b { color: var(--ink); font-weight: 600; }
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.9rem, 7vw, 5.4rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 650;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), #a855f7 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lead {
  max-width: 620px;
  margin: 26px auto 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.hero-actions {
  margin-top: 38px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}
.button.secondary:hover { background: var(--surface-2); }
.button.large { padding: 12px 24px; font-size: 16px; }

.hero-stats {
  margin-top: 56px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 48px;
}
.hero-stats .stat b {
  display: block;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.hero-stats .stat span { color: var(--muted); font-size: 14px; }

.marquee-row {
  margin-top: 60px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 34px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.marquee-row span { opacity: 0.85; }

/* ============================ Sections ============================ */

.section { padding: clamp(64px, 10vw, 120px) 0; }
.section.alt { background: var(--canvas-2); }

.section-head { margin-bottom: 44px; }
.section-head.center { text-align: center; }
.kicker,
.eyebrow.plain {
  display: inline-block;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.section-head p {
  margin: 16px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 1.1rem;
}
.section-head.center p { margin-left: auto; margin-right: auto; }
.section-head.spread {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* ============================ Category grid (home) ============================ */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.cat-card {
  position: relative;
  display: block;
  padding: 26px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--hairline);
}
.cat-card .cat-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 34px;
}
.cat-card .cat-icon svg { width: 22px; height: 22px; }
.cat-card h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.cat-card p { margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.45; }
.cat-card .cat-go {
  margin-top: 18px;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); font-size: 14px; font-weight: 550;
}
.cat-card:hover .cat-go { gap: 9px; }

/* ============================ Sub-page hero ============================ */

.page-hero {
  padding: clamp(64px, 12vh, 120px) 0 clamp(40px, 6vh, 64px);
  text-align: center;
}
.page-hero.left { text-align: left; }
.page-hero .eyebrow { text-transform: none; letter-spacing: 0; }
.page-hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 650;
}
.page-hero .lead {
  max-width: 640px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.5;
}
.page-hero.left .lead { margin-left: 0; }

/* Directory search + suggest */
.search-shell {
  max-width: 640px;
  margin: 34px auto 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.search-shell input {
  flex: 1 1 340px;
  min-width: 0;
  padding: 13px 20px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-shell input::placeholder { color: var(--muted); }
.search-shell input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ============================ Filters ============================ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.filter-button:hover { border-color: var(--muted); color: var(--ink); }
.filter-button.active {
  background: var(--ink);
  color: var(--canvas);
  border-color: var(--ink);
}

/* ============================ Directory cards ============================ */

.directory-grid {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.directory-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.directory-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--hairline);
}
.directory-card[hidden] { display: none; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-top img {
  width: 38px; height: 38px;
  object-fit: contain;
  border-radius: 9px;
}
.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}
.directory-card h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.directory-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
  flex: 1;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 18px;
}
.chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 550;
  transition: gap 0.2s var(--ease);
}
.card-link::after {
  content: "→";
  transition: transform 0.2s var(--ease);
}
.directory-card:hover .card-link::after { transform: translateX(3px); }

.empty {
  display: none;
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}
.empty.visible { display: block; }

/* ============================ Panels / grid-2 ============================ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.panel {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
}
.panel h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.panel p { margin: 0; color: var(--muted); line-height: 1.55; }

/* ============================ Feedback form ============================ */

.feedback-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.feedback-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink);
}
.feedback-form label.full { grid-column: 1 / -1; }
.feedback-form input,
.feedback-form select,
.feedback-form textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.feedback-form textarea { min-height: 140px; resize: vertical; }
.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ghost {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
}
.ghost:hover { color: var(--ink); }
.status { color: var(--muted); font-size: 14px; }

/* ============================ Footer ============================ */

.site-footer {
  border-top: 1px solid var(--hairline-2);
  background: var(--canvas-2);
  padding: 40px 0;
  color: var(--muted);
  font-size: 13.5px;
}
.footer-row {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-weight: 500; }
.footer-links a:hover { color: var(--ink); }

/* Owner entry (injected by xopen-site.js) — keep it discreet */
.owner-entry {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 16px;
  height: 16px;
  z-index: 80;
  opacity: 0.12;
  color: var(--muted);
}
.owner-entry:hover { opacity: 0.6; }
.owner-entry span,
.owner-entry span::before {
  position: absolute; display: block; content: "";
}
.owner-entry span {
  left: 4px; top: 7px; width: 8px; height: 6px;
  border: 1.5px solid currentColor; border-radius: 2px;
}
.owner-entry span::before {
  left: 1px; top: -6px; width: 6px; height: 6px;
  border: 1.5px solid currentColor;
  border-right-color: transparent; border-bottom-color: transparent;
  border-radius: 7px 7px 0 0; transform: rotate(-16deg);
}

/* ============================ Motion ============================ */

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
[data-reveal] {
  animation: riseIn 0.7s var(--ease) both;
  animation-delay: var(--d, 0s);
}

/* ============================ Responsive ============================ */

@media (max-width: 900px) {
  .cat-grid,
  .directory-grid,
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-inner { gap: 8px; padding: 0 16px; }
  .nav-links { gap: 0; margin-left: 2px; }
  .nav-links a { padding: 6px 9px; font-size: 13.5px; }
  .nav-cta { display: none; }
  .feedback-form,
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .nav-brand span.word { display: none; }
  .nav-lang a { padding: 4px 6px; }
}

@media (max-width: 560px) {
  .cat-grid,
  .directory-grid,
  .grid-3 { grid-template-columns: 1fr; }
  .hero-stats { gap: 14px 28px; }
  .footer-row { flex-direction: column; align-items: flex-start; }
}

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