/* SAPL Preview Theme - Light, clean, professional */

/* Reset and base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand colors from SAPL logo */
  --color-primary: #028392;        /* teal — logo primary swoosh */
  --color-primary-hover: #026d79;  /* teal darker */
  --color-primary-light: #7bbdbc;  /* teal light — logo secondary swoosh */
  --color-accent: #8f9cc1;         /* slate blue — logo inner element */
  --color-accent-muted: #799cc1;   /* muted blue — logo connector */

  /* Page colors — muted cool grey */
  --color-bg: #e2e8f0;
  --color-bg-card: #edf2f7;
  --color-text: #1a1a2e;
  --color-text-secondary: #4a5568;
  --color-surface: #e2e8f0;
  --color-border: #cbd5e1;
  --color-code-bg: #1e1e2e;

  /* Shadows — teal-tinted, layered */
  --shadow-sm: 0 1px 2px rgba(2, 131, 146, 0.05);
  --shadow-md:
    0 1px 3px rgba(2, 131, 146, 0.06),
    0 4px 12px rgba(2, 131, 146, 0.04);
  --shadow-lg:
    0 2px 4px rgba(2, 131, 146, 0.04),
    0 8px 24px rgba(2, 131, 146, 0.06),
    0 24px 48px rgba(2, 131, 146, 0.04);

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --max-width: 1100px;
}

/* Dark mode — aligned with sapl-vaadin-theme (styles-aura.css) */
[data-theme="dark"] {
  --color-bg: hsl(210, 10%, 12%);             /* #1b1e21 — aura-background-color-dark */
  --color-bg-card: hsl(210, 10%, 15%);        /* ~#222629 — 1 step lighter */
  --color-text: hsl(210, 10%, 90%);           /* #e3e4e6 */
  --color-text-secondary: hsl(210, 10%, 60%); /* #929699 */
  --color-surface: hsl(210, 10%, 18%);        /* ~#292c2f — 2 steps lighter */
  --color-border: rgba(255, 255, 255, 0.10);  /* lumo-contrast-10pct */
  --color-primary: hsl(179, 43%, 44%);        /* #3fa09e — aura-accent-color-dark */
  --color-primary-hover: hsl(179, 43%, 52%);  /* lighter on hover */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:
    0 1px 3px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 24px 48px rgba(0, 0, 0, 0.3);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  transition: color 150ms ease, border-color 150ms ease;
}

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

/* Show sun in dark mode, moon in light mode */
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo img {
  height: 52px;
  width: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-subtitle {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

/* Logo theme swap — light is default, dark only with explicit attribute */
.logo img.logo-dark { display: none; }
.logo img.logo-light { display: block; }
html[data-theme="dark"] .logo img.logo-dark { display: block; }
html[data-theme="dark"] .logo img.logo-light { display: none; }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }

.nav-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 150ms ease;
}

.nav-links a:hover { color: var(--color-primary); }

/* Main content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Section blocks */
.section {
  padding: 4rem 0;
}

.section + .section {
  border-top: 1px solid var(--color-border);
}

/* Hero */
.hero {
  padding: 4rem 0 2rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.5;
}

/* CTA buttons */
.cta-group { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 150ms ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-bg-card);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-card);
}

/* Editor embed — dark card with subtle ambient glow */
.editor-embed {
  margin: 2rem auto;
  max-width: 800px;
  position: relative;
}

.editor-embed::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  width: 120%;
  height: 140%;
  background: radial-gradient(
    50% 50% at 50% 50%,
    rgba(2, 131, 146, 0.08) 0%,
    rgba(123, 189, 188, 0.03) 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .editor-embed::before {
  background: radial-gradient(
    50% 50% at 50% 50%,
    rgba(91, 190, 197, 0.15) 0%,
    rgba(123, 189, 188, 0.05) 50%,
    transparent 100%
  );
}

.editor-embed sapl-code,
.editor-embed sapl-demo {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    var(--shadow-lg);
}

/* Feature grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.feature {
  background: var(--color-bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.feature:hover {
  border-color: rgba(2, 131, 146, 0.3);
  box-shadow: var(--shadow-md);
}

.feature h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text);
}

.feature p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.feature-meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
  margin-top: 0.5rem;
}

.feature a {
  color: var(--color-primary);
  text-decoration: none;
}

.feature a:hover { text-decoration: underline; }

/* Integration tiers */
.integration-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.integration-tiers a {
  color: var(--color-primary);
  text-decoration: none;
}

.integration-tiers a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .integration-tiers { grid-template-columns: 1fr; }
}

.integration-note {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: 0.5rem;
}

/* Code tabs */
.code-tabs {
  margin-top: 1.5rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-code-bg);
}

.tab-bar {
  display: flex;
  gap: 0;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.tab:hover { color: var(--color-text); }

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  padding: 0;
}

.tab-content.active { display: block; }

/* Fallback before CodeMirror loads */
.tab-content pre.cm-source {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--color-code-bg);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
}

.tab-content pre.cm-source code {
  font-family: inherit;
  background: none;
}

/* CodeMirror in tabs */
.tab-content .cm-editor {
  font-size: 0.85rem;
  border-radius: 0;
  padding: 0.5rem 0;
}

.tab-content .cm-gutters {
  background: transparent;
  border-right: none;
}

/* Terminal output */
.terminal {
  background: #0c0c0c;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.test-output {
  margin: 0;
  padding: 1rem 1.5rem;
  background: #0c0c0c;
  color: #cccccc;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  overflow-x: auto;
}

.test-output code { font-family: inherit; background: none; }
.term-prompt { color: #6c7086; }
.term-bold { color: #e0e0e0; font-weight: 700; }
.test-pass { color: #4ec751; }
.test-pass-bold { color: #4ec751; font-weight: 700; }
.test-dim { color: #555555; }

/* Testing demo layout */
.testing-demo { margin-top: 1.5rem; }

.testing-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.testing-col {
  background: var(--color-code-bg);
  min-width: 0;
}

.testing-label {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c7086;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
}

.testing-code { overflow-x: auto; }

.testing-code pre.cm-source {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--color-code-bg);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
}

.testing-code pre.cm-source code { font-family: inherit; background: none; }

.testing-code .cm-editor {
  font-size: 0.8rem;
  border-radius: 0;
  padding: 0.25rem 0;
}

.testing-code .cm-gutters {
  background: transparent;
  border-right: none;
}

.testing-output {
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .testing-columns { grid-template-columns: 1fr; }
}

/* Project logos */
.project-logo {
  height: 36px;
  width: auto;
  display: block;
  margin-bottom: 0.5rem;
}

/* Partner logos */
.partner-logos {
  margin-top: 2rem;
}

.partner-logos h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

.logo-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem 2.5rem;
}

.logo-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 150ms ease, box-shadow 150ms ease;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .logo-grid a {
  background: rgba(255, 255, 255, 0.65);
}

.logo-grid a:hover { opacity: 1; }

.logo-grid img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.logo-text-fallback {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* EU funding acknowledgment */
.eu-funding {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.eu-flag {
  flex-shrink: 0;
  width: 64px;
  height: auto;
}

.eu-funding p {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.eu-funding a {
  color: var(--color-primary);
  text-decoration: none;
}

.eu-funding a:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

/* Typography */
h1, h2, h3, h4 { letter-spacing: -0.03em; }

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

h3 { font-size: 1.1rem; }
p + p { margin-top: 1rem; }

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 2.5rem 0 1.5rem; }
  .hero .subtitle { font-size: 1rem; }
  .section { padding: 2.5rem 0; }
  .features { grid-template-columns: 1fr; }
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.8rem; }
}
