/* ---------- Typography: clean system UI sans ---------- */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji",
               "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

  /* Theme */
  --bg: #211D29;
  --text: #F5F2FA;
  --heading: #A795DD;
  --link: #C7B8F0;
  --link-hover: #D8CCF7;
  --focus: #D8CCF7;
}

/* ---------- IPA (phonetic) text ---------- */
.ipa {
  font-family: "Gentium Plus", "Charis SIL", "Doulos SIL", "Noto Sans", var(--font-sans);
  font-variant-ligatures: none;
  font-feature-settings: "kern" 1, "mark" 1, "mkmk" 1;
}


/* ---------- Base layout ---------- */
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  padding: clamp(24px, 6vw, 80px);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* helps long words/URLs not overflow on mobile */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Optional: limit line length for comfort across devices */
.container {
  max-width: 70ch;     /* ~70 characters per line = comfy reading */
  margin: 0 auto;      /* center the content */
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.site-title {
  margin: 0;
  line-height: 1.2;
  color: var(--heading);
  letter-spacing: 0.2px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
}


.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
}


.tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  padding-bottom: 2px;

  font: inherit;
  color: var(--link);
  cursor: pointer;

  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--heading);
  text-decoration: none;
}

.tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ---------- Tab links (anchors inside tabs row) ---------- */
.tabs a.tab {
  /* override base link padding so the tab row aligns */
  padding-inline: 0;
}

/* ---------- Abstract toggles ---------- */
.paper-abstract {
  margin-top: 0.35rem;
}

.paper-abstract > summary {
  list-style: none;        /* Firefox */
  display: inline;
}

.paper-abstract > summary::-webkit-details-marker {
  display: none;           /* Safari/Chrome */
}

.paper-abstract > summary::marker {
  content: "";             /* Firefox */
}

.abstract-toggle {
  color: var(--link);
  cursor: pointer;
}

.abstract-toggle:hover,
.abstract-toggle:focus {
  text-decoration: underline;
  color: var(--link-hover);
  text-underline-offset: 3px;
}

.abstract-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 6px;
}

/* Abstract paragraphs inside the Writing section */
.abstract-text {
  text-align: justify;
}


/* ---------- Panels (simple “pop in” feel) ---------- */
.tab-panel {
  animation: fadeIn 140ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Links ---------- */
a {
  color: var(--link);
  text-decoration: none;
  /* bigger tap target on touch devices without changing layout */
  padding-inline: 2px;
}

a:hover,
a:focus {
  text-decoration: underline;
  color: var(--link-hover);
  text-underline-offset: 3px;
}

/* ---------- Headings & lists spacing ---------- */
h1, h2, h3 { line-height: 1.25; }
h2, h3 { color: var(--heading); }
h2 { margin-top: 2rem; }
h3 { margin-top: 1.5rem; }
ul { margin: 0.5rem 0 1rem 1.25rem; }

p { margin: 0.75rem 0; }
.prose p { text-align: justify; }

/* Phones */
@media (max-width: 800px) {
  body {
    padding: 24px 20px;
    font-size: 17px;
    line-height: 1.7;
  }

  h2 { font-size: 1.35rem; margin-top: 1.25rem; }
  h3 { font-size: 1.15rem; margin-top: 1rem; }
  ul { margin-left: 1rem; }

  /* Justified text can look gappy on narrow screens */
  .prose p { text-align: left; }
  .abstract-text { text-align: left; }
}

/* Very small phones */
@media (max-width: 360px) {
  body { font-size: 16px; }
}

/* ---------- Research navigation (in-panel) ---------- */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.research-controls {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0.5rem 0 0.75rem;
  margin: 0 0 1rem;
  border-bottom: 1px solid rgba(199, 184, 240, 0.25);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
}








.research-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
}

.research-jump .jump-link {
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.research-jump .jump-sep {
  color: var(--link);
  opacity: 0.9;
  margin: 0 -0.25rem;
  user-select: none;
}



[id^="research-"] {
  scroll-margin-top: calc(var(--research-controls-h, 5.75rem) + 12px); /* clears the sticky controls */
}

[id^="research-"]:target:not(#research-top) {
  outline: 2px solid rgba(216, 204, 247, 0.8);
  outline-offset: 6px;
  border-radius: 8px;
}


/* Phones */


:root {
  --safe-top: env(safe-area-inset-top, 0px);
}
