/* ==========================================================================
   ope-osoba.me custom minimal dark theme
   ========================================================================== */

/* ---- self-hosted font: Lexend (SIL OFL 1.1; license in assets/fonts/OFL-Lexend.txt)
   Owner's font preference, in order: Lexend > Inter > Atkinson Hyperlegible.
   All three are OFL-licensed and self-hostable; to switch, replace the two
   @font-face srcs below and the --font stack, and drop the matching woff2s in
   assets/fonts/. (Inter ships a true italic; Lexend does not — italics are
   synthesized.) ------------------------------------------------------------- */
@font-face {
  font-family: "Lexend";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/lexend-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lexend";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/lexend-700-normal.woff2") format("woff2");
}

:root {
  /* Swap this one line to try a different typeface site-wide. */
  --font: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Palette: "Amber Raised" — cool-warm charcoal with a warm amber accent,
     and a slightly lighter content panel (--content-bg) for a two-tone surface. */
  --bg:          #141519;
  --bg-elev:     #1f2228;
  --content-bg:  #1e2128;
  --border:      #34373f;
  --text:        #e3e1da;
  --text-strong: #faf7f0;
  --muted:       #a39e92;
  --accent:      #e0a86a;
  --accent-dim:  #b98a52;
  --accent-soft: rgba(224, 168, 106, 0.13);
  --maxw:        1080px;
  --sidebar-w:   250px;
  --radius:      10px;
  --gap:         clamp(1.75rem, 4vw, 3.25rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

p { margin: 0 0 1rem; }
strong { color: var(--text-strong); font-weight: 600; }

/* ---- shell ---------------------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) clamp(1.1rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

/* ---- sidebar -------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: clamp(2rem, 5vw, 4.5rem);
  display: flex;
  flex-direction: column;
}

.avatar {
  width: 158px;
  height: 200px;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  filter: grayscale(12%) contrast(1.02);
}

.name {
  margin: 1.15rem 0 0.1rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  line-height: 1.2;
}

.role {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.blurb {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 1.1rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.92rem;
}
.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.18rem 0;
  color: var(--text);
}
.sidebar-links a:hover { color: var(--accent); text-decoration: none; }
.sidebar-links a::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-dim);
  flex: none;
}

/* ---- content / tabs ------------------------------------------------------- */
.content {
  min-width: 0;
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(1.2rem, 3vw, 2rem) clamp(1.3rem, 3vw, 2.2rem);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.9rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.96rem;
  padding: 0.55rem 0.65rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text-strong);
  border-bottom-color: var(--accent);
}

/* panels: visible by default (no-JS friendly); JS hides inactive ones */
.panel { margin-bottom: 2.5rem; max-width: 46rem; }
body.js .panel { display: none; }
body.js .panel.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2.1rem 0 0.9rem;
}
.panel > h2:first-child { margin-top: 0; }
.panel h3 { color: var(--text-strong); font-size: 1.05rem; margin: 1.4rem 0 0.4rem; }
.panel ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.panel li { margin-bottom: 0.4rem; }

.lead { font-size: 1.08rem; color: var(--text-strong); }

/* ---- publications: filter chips + grouped list ---------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.6rem;
}
.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.chip:hover { border-color: var(--accent-dim); color: var(--text-strong); }
.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-strong);
}
.chip .chip-count {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip.active .chip-count { color: var(--accent); }

.pub-group { margin-bottom: 1.8rem; }
.pub-group[hidden] { display: none; }
.pub-group-title {
  font-size: 0.82rem !important;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem !important;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.pub { padding: 0.55rem 0; }
.pub + .pub { border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.pub-title {
  color: var(--text-strong);
  font-weight: 700;
  line-height: 1.4;
}
.pub-title:hover { color: var(--accent); text-decoration: none; }
.pub-meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.pub-meta .cite { color: var(--accent-dim); }

.scholar-note { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.6rem; }

/* ---- writing entries ------------------------------------------------------ */
.entry { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.entry:last-child { border-bottom: none; }
.entry-title { color: var(--text-strong); font-weight: 500; }
.entry-meta { font-size: 0.85rem; color: var(--muted); margin-top: 0.1rem; }
.entry-meta a { color: var(--accent-dim); }

.muted-note {
  margin-top: 1.4rem;
  padding: 0.9rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  grid-column: 1 / -1;
  margin-top: 1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 760px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 1.1rem;
  }
  .avatar { width: 92px; height: 116px; }
  .name { margin-top: 0; font-size: 1.35rem; }
  .role { width: 100%; }
  .blurb { width: 100%; }
  .sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.2rem 1.1rem;
    width: 100%;
  }
  .panel { max-width: none; }
}

/* ==========================================================================
   Blog: post reading pages + Writing-tab post index
   ========================================================================== */

/* ---- standalone post page ---- */
.post-wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3.2rem) clamp(1.1rem, 4vw, 1.6rem) 4rem;
}
.post-nav { margin-bottom: 2rem; font-size: 0.9rem; }
.post-nav a { color: var(--muted); }
.post-nav a:hover { color: var(--accent); text-decoration: none; }
.post-title {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
}
.post-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* article typography */
.post-article { font-size: 1.02rem; }
.post-article h2 { color: var(--text-strong); font-size: 1.4rem; margin: 2.2rem 0 0.6rem; line-height: 1.25; }
.post-article h3 { color: var(--text-strong); font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
.post-article p { margin: 0 0 1.1rem; }
.post-article ul, .post-article ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
.post-article li { margin-bottom: 0.35rem; }
.post-article a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post-article img { max-width: 100%; height: auto; border-radius: 8px; }
.post-article hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-article blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent-dim);
  color: var(--muted);
}
.post-article table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; font-size: 0.92rem; }
.post-article th, .post-article td { border: 1px solid var(--border); padding: 0.45rem 0.7rem; text-align: left; }
.post-article th { background: var(--bg-elev); color: var(--text-strong); }
.post-footer { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; }

/* ---- tags (shared) ---- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.post-meta .tags { margin-left: 0.2rem; vertical-align: middle; }

/* ---- Writing-tab post index ---- */
.post-list { margin: 0 0 1.5rem; }
.post-item { padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.post-item[hidden] { display: none; }
.post-item-title { color: var(--text-strong); font-weight: 700; }
.post-item-title:hover { color: var(--accent); text-decoration: none; }
.post-item-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.1rem; }
.post-item-summary { margin: 0.25rem 0 0.35rem; color: var(--text); font-size: 0.95rem; }
.posts-empty { color: var(--muted); font-size: 0.9rem; }

/* ==========================================================================
   Accessibility: visible keyboard focus + reduced-motion
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
/* don't show focus ring on mouse click, only keyboard (browsers handle this via :focus-visible) */
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  body.js .panel.active { animation: none; }
  * { scroll-behavior: auto; }
}
