/*
  European Institute for Sound Studies (EISS)
  Simple, responsive, accessible styles
*/

:root {
  --bg: #ffffff;
  --text: #0f172a; /* slate-900 */
  --muted: #475569; /* slate-600 */
  --brand: #2563eb; /* blue-600 */
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --surface: #f1f5f9; /* slate-100 */
  --border: #e2e8f0;
  --shadow: 0 10px 25px rgba(2, 6, 23, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --brand: #60a5fa;
    --brand-600: #60a5fa;
    --brand-700: #3b82f6;
    --surface: #0f172a;
    --border: #1f2937;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html:focus-within { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Lato", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1100px, 92%); margin: 0 auto; }
.section { padding: 4rem 0; }
.lead { font-size: 1.125rem; color: var(--muted); }

/* Header / Nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-text { letter-spacing: .02em; }

.nav { position: relative; }
.nav ul { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; align-items: center; }
.nav li { display: inline-flex; align-items: center; }
.nav li + li::before { content: "·"; opacity: .5; margin: 0 .5rem; }
.nav-link { display: inline-block; padding: .25rem .25rem; color: var(--text); text-decoration: none; }
.nav-link:hover { text-decoration: underline; }

/* Mobile nav toggle */
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; }
.nav-toggle .bar { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .nav { position: absolute; top: 100%; right: 0; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: .5rem; padding: .5rem; display: none; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; }
}

/* Hero */
.hero.minimal {
  position: relative;
  padding: 5rem 0 3rem;
  color: var(--text);
}
.hero .hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    /* faint grid overlay only (no banner image) */
    linear-gradient(0deg, rgba(15,23,42, .02), rgba(15,23,42,.02)),
    repeating-linear-gradient(0deg, rgba(2,6,23,.06), rgba(2,6,23,.06) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, rgba(2,6,23,.06), rgba(2,6,23,.06) 1px, transparent 1px, transparent 40px);
  background-size: auto, auto, auto;
  background-position: center;
  background-repeat: no-repeat;
}
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.75rem); line-height: 1.15; margin: 0 0 .25rem; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 .5rem; font-weight: 600; }
.tag { color: var(--muted); margin: .5rem 0 1rem; }
.hero-cta .link { font-weight: 700; }

/* Cards / Grid */
.grid { display: grid; gap: 1rem; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid.three { grid-template-columns: 1fr; } }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: .25rem; padding: 1rem; box-shadow: var(--shadow); }

/* Lists */
.list { padding-left: 1rem; }

/* Buttons */
.btn { display: inline-block; border: 1px solid var(--border); color: var(--text); background: transparent; padding: .5rem .9rem; border-radius: .25rem; text-decoration: none; font-weight: 600; }
.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn.primary { background: var(--brand-600); color: white; border-color: var(--brand-700); }
.btn.primary:hover { background: var(--brand-700); }

/* Form */
.contact-form { margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 820px) { .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; }
label span { display: inline-block; margin-bottom: .25rem; }
input, textarea { width: 100%; padding: .6rem .75rem; border-radius: .5rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.form-note { font-size: .9rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; background: var(--surface); }
.site-footer .muted { color: var(--muted); margin-top: .25rem; }
.site-footer .list-inline { list-style: none; display: flex; gap: .25rem; margin: .5rem 0 0; padding: 0; align-items: center; flex-wrap: wrap; }
.site-footer .list-inline li { display: inline-flex; align-items: center; }
.site-footer .list-inline li + li::before { content: "·"; opacity: .5; margin: 0 .5rem; }
.site-footer .list-inline a { color: var(--muted); text-decoration: none; }
.site-footer .list-inline a:hover { color: var(--brand); text-decoration: underline; }

/* Skip link */
.skip-link { position: absolute; left: -999px; top: -999px; background: var(--brand-600); color: white; padding: .5rem .75rem; border-radius: .5rem; }
.skip-link:focus { left: .5rem; top: .5rem; z-index: 100; }

/* Back to top */
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; padding: .5rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow); cursor: pointer; display: none; }
.back-to-top.show { display: inline-block; }

/* Focus styles */
:where(a, button, input, textarea):focus-visible { outline: 3px solid color-mix(in oklab, var(--brand) 70%, white); outline-offset: 2px; border-radius: .25rem; }

/* Minimal archive spacing */
.archive h3 { margin-bottom: .25rem; }
.archive p { margin-top: 0; }
.archive .related { margin: .35rem 0 1rem; font-size: .95rem; color: var(--muted); }
.archive .related a { color: var(--brand); }
.list.tight { padding-left: 1rem; }
.mt { margin-top: 1rem; }

/* Contact address block */
.contact-address { font-style: normal; color: var(--text); }
.contact-address a { color: var(--brand); }
.contact-address a:hover { text-decoration: underline; }

/* Small inline icon link next to headings */
.icon-link { display: inline-flex; vertical-align: middle; margin-left: .4rem; color: var(--muted); text-decoration: none; }
.icon-link:hover { color: var(--brand); }
.icon-link svg { width: 16px; height: 16px; display: inline-block; }
.icon-link.disabled { opacity: .6; pointer-events: none; }

/* Static waveform line at bottom */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 40px; pointer-events: none; opacity: .25;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80'%3E%3Cpath d='M0,40 C150,20 250,60 400,40 C550,20 650,60 800,40 C950,20 1050,60 1200,40' fill='none' stroke='%2394a3b8' stroke-width='2'/%3E%3C/svg%3E") center/cover no-repeat;
}

/* Methodology layout */
.methodology { margin-top: 2rem; }
.methodology .subheading { margin-top: .25rem; }

.methodology-grid { display: grid; gap: 1.25rem; }
@media (min-width: 768px) {
  .methodology-grid { grid-template-columns: minmax(220px, 280px) 1fr; gap: 2rem; }
}

/* Sticky mini-TOC */
.mini-toc { position: sticky; top: 5.5rem; align-self: start; font-size: .95rem; }
.mini-toc ol { margin: 0; padding-left: 1.25rem; }
.mini-toc li { margin: .35rem 0; }
.mini-toc a { color: inherit; text-decoration: none; opacity: .9; }
.mini-toc a:hover, .mini-toc a:focus { text-decoration: underline; text-underline-offset: 2px; opacity: 1; }

/* Methodology content spacing and anchor offset */
.methodology-content h4 { margin-top: 1.25rem; }
.methodology-content [id] { scroll-margin-top: 6.5rem; }

/* Subtle German annotation styling */
.de {
  font-style: italic;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  text-decoration-thickness: from-font;
  opacity: .9;
}
@supports (text-decoration-color: currentColor) {
  .de { text-decoration-color: currentColor; }
}

/* Dataset card and chips */
.dataset-card {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1rem;
  box-shadow: var(--shadow);
  background: var(--bg);
  max-width: 720px; /* keep narrow like text */
}
.dataset-card h4 { margin: 0 0 .35rem; }
.dataset-card .ds-blurb { margin: 0 0 .75rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin: 1rem 0; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  min-height: 36px;
  padding: .5rem .75rem;
  border-radius: .7rem;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  transition: box-shadow .15s ease, background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.chip .chip-label { font-weight: 700; letter-spacing: .02em; }
.chip .chip-sub { opacity: .85; }
.chip.primary { background: var(--brand-600); color: #fff; border-color: var(--brand-700); }
.chip.primary:hover { box-shadow: var(--shadow); }
.chip.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.chip.secondary:hover { box-shadow: var(--shadow); }

/* Disabled state */
.chip[aria-disabled="true"] {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: auto; /* allow tooltip */
}
.chip[aria-disabled="true"]:hover { box-shadow: none; }

/* Tooltip (attribute-based) */
.chip[data-tooltip] { position: relative; }
.chip[data-tooltip]:hover::after, .chip[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: color-mix(in oklab, var(--text) 92%, #000);
  color: #fff;
  border-radius: .35rem;
  padding: .25rem .5rem;
  font-size: .8rem;
  box-shadow: var(--shadow);
  z-index: 10;
}
.chip[data-tooltip]:hover::before, .chip[data-tooltip]:focus-visible::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: color-mix(in oklab, var(--text) 92%, #000);
}

.dataset-card .ds-meta { margin: .5rem 0 0; font-size: .95rem; color: var(--text); }
.dataset-card .ds-smallprint { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }
