/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --cream:        #F7F2E8;
  --cream-dark:   #EDE5D0;
  --cream-deeper: #E0D5BE;

  --sage:         #7A9E87;
  --sage-dark:    #567A63;
  --sage-light:   #B2CBBA;
  --sage-faint:   #E8F0EB;

  --brown:        #8B6F4E;
  --brown-light:  #C4A882;
  --brown-faint:  #F0E8DC;

  --text:         #2C2018;
  --text-muted:   #6B5A45;
  --text-light:   #9C876B;

  --border:       #D6C9B0;
  --border-light: #EAE0CC;

  --radius:       4px;
  --radius-lg:    8px;

  --font-serif:   'EB Garamond', 'Garamond', Georgia, serif;
  --font-sans:    'Source Sans 3', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a {
  color: var(--sage-dark);
  text-decoration: underline;
  text-decoration-color: var(--sage-light);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--brown); text-decoration-color: var(--brown-light); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

.section-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section { padding: 5rem 0; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ============================================================
   NAV
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.nav-name:hover { color: var(--sage-dark); text-decoration: none; }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav-links a:hover { color: var(--sage-dark); }

/* ============================================================
   HERO / ABOUT
   ============================================================ */
#about {
  padding-top: 6rem;
  padding-bottom: 5rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about-bio {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-top: 1.25rem;
}

.about-details { margin-top: 2rem; }

.detail-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.detail-row:first-child { border-top: 1px solid var(--border-light); }

.detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  min-width: 90px;
}

.detail-value { color: var(--text-muted); }

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.tag {
  background: var(--cream-dark);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
}

/* ============================================================
   HAPAX WIDGET
   ============================================================ */
#hapax {
  background: var(--cream-dark);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.hapax-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hapax-date {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

/* Word display */
.hapax-word-block {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 1.5rem;
}

.hapax-greek {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--sage-dark);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.hapax-translit {
  font-size: 1rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.hapax-pos {
  font-size: 0.82rem;
  color: var(--brown);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Passage */
.hapax-passage {
  background: var(--brown-faint);
  border-left: 3px solid var(--brown-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.hapax-passage-ref {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brown);
  margin-bottom: 0.6rem;
}

.hapax-passage-greek {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.4rem;
}

.hapax-passage-english {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Corpus note */
.hapax-corpus-note {
  font-size: 0.85rem;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-bottom: 2rem;
  font-style: italic;
}

/* Analysis tabs */
.hapax-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.65rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--sage-dark); }
.tab-btn.active {
  color: var(--sage-dark);
  border-bottom-color: var(--sage-dark);
}

.hapax-panels { margin-top: 0; }

.tab-panel {
  display: none;
  background: var(--cream);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 1.75rem 2rem;
}
.tab-panel.active { display: block; }

.tab-panel p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.75;
}
.tab-panel p:last-child { margin-bottom: 0; }

.analysis-field { margin-bottom: 1.25rem; }

.analysis-key {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brown);
  margin-bottom: 0.3rem;
}

.analysis-value {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.component-list {
  list-style: none;
  margin-top: 0.5rem;
}
.component-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border-light);
}
.component-list li:last-child { border-bottom: none; }

.component-part {
  font-family: var(--font-serif);
  color: var(--sage-dark);
  font-size: 1rem;
  min-width: 140px;
}

.component-gloss { color: var(--text-muted); }

.cognate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.cognate {
  background: var(--sage-faint);
  border: 1px solid var(--sage-light);
  color: var(--sage-dark);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
  border-radius: 2rem;
}

/* Loading / error states */
.hapax-loading {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-light);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.hapax-error {
  text-align: center;
  padding: 2rem;
  color: var(--brown);
  font-size: 0.9rem;
  font-style: italic;
}

/* ============================================================
   PROJECTS
   ============================================================ */
#projects { padding-top: 5rem; padding-bottom: 5rem; }

.projects-intro {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 1rem 0 2.5rem;
  max-width: 560px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}
.project-card:hover {
  border-color: var(--sage);
  box-shadow: 0 2px 12px rgba(90, 110, 80, 0.1);
  text-decoration: none;
  color: inherit;
}

.project-card-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-dark);
  margin-bottom: 0.6rem;
}

.project-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.project-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.project-card-footer {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--sage-dark);
  font-weight: 600;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  background: var(--cream-dark);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-light);
  text-decoration: none;
}
.footer-links a:hover { color: var(--sage-dark); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 680px) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .project-grid { grid-template-columns: 1fr; }
  .hapax-word-block { padding: 1.5rem; }
  .tab-panel { padding: 1.25rem; }
  .tab-btn { padding: 0.55rem 0.85rem; font-size: 0.75rem; }
  section { padding: 3.5rem 0; }
}
