/* ==========================================================
   ROSETTA DOCUMENTATION SYSTEM
   Shared, low-specificity, reusable styles for Rosetta index
   and documentation pages.
   ========================================================== */

:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --page-bg: #eef3f6;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-blue: #eaf5fb;
  --navy: #07162b;
  --navy-soft: #102844;
  --text: #172129;
  --muted: #65727c;
  --muted-light: #8b99a5;
  --blue: #137a98;
  --blue-bright: #2f8dff;
  --blue-light: #5fc8ff;
  --rosetta: #ff6c80;
  --border: #d7e1e7;
  --border-blue: #c5ddea;
  --radius: 12px;
  --radius-small: 8px;
  --shadow: 0 14px 36px rgba(20, 48, 68, 0.08);
  --space-1: 0.4rem;
  --space-2: 0.7rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --page-width: 1180px;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, #dfeef6 0, var(--page-bg) 24rem),
    var(--page-bg);
  font-size: 1rem;
  line-height: 1.65;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(calc(100% - 2rem), var(--page-width));
  margin-inline: auto;
  padding-block: clamp(1rem, 3vw, 2.5rem) clamp(3rem, 6vw, 5rem);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--tight {
  gap: var(--space-1);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.glass {
  padding: clamp(1.25rem, 2vw, 1.75rem);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.label {
  margin-bottom: 0;
  color: var(--rosetta);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta {
  max-width: 76ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.notice {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.title-xl {
  margin-bottom: 0;
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
}

.title-md {
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.project-title {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease;
}

.link:hover,
.link:focus-visible {
  color: var(--blue-bright);
  text-decoration-color: currentColor;
}

:where(.segment[id]) .link[href="#"] {
  color: var(--muted-light);
  text-decoration-color: transparent;
  cursor: default;
  pointer-events: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.8rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-blue);
  border-radius: 999px;
  color: var(--blue);
  background: var(--surface-blue);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.tag--accent {
  border-color: rgba(255, 108, 128, 0.36);
  color: #a83f52;
  background: rgba(255, 108, 128, 0.08);
}

.site-header {
  justify-content: space-between;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(95, 200, 255, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(95, 200, 255, 0.12), transparent 42%),
    var(--navy);
  box-shadow: var(--shadow);
}

.site-header .label {
  color: var(--blue-light);
}

.site-header .meta {
  color: #b8c8d7;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-small);
  color: #eaf5fb;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-link:hover,
.nav-link:focus-visible {
  border-color: var(--rosetta);
  color: #fff;
  background: rgba(255, 108, 128, 0.1);
}

.section {
  gap: var(--space-3);
}

.section-heading {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-blue);
}

.segment-list {
  display: grid;
}

.index-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.segment {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr);
  gap: var(--space-3);
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.segment:first-child {
  padding-top: 0;
}

.segment:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.index-grid .segment {
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  min-height: 4.75rem;
  padding: 0.9rem;
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.index-grid .segment:hover {
  border-color: var(--blue-light);
  background: var(--surface-blue);
}

.segment-time {
  color: var(--rosetta);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.segment-content {
  gap: var(--space-2);
}

.notice--footer {
  padding: 0.75rem 0.25rem 0;
  text-align: center;
}

@media (max-width: 820px) {
  .index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .page {
    width: min(calc(100% - 1rem), var(--page-width));
  }

  .site-header {
    align-items: flex-start;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .split {
    display: grid;
  }

  .segment,
  .index-grid .segment {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .index-grid {
    grid-template-columns: 1fr;
  }
}
