/* ─── Philo Library — Shared Author Guide Styles ────────────────────────── */

/* ── Theme Variables ── */
:root, [data-theme="light"] {
  --bg: #F5F0E3;
  --bg-secondary: #E8E1CD;
  --bg-card: #FEFCF6;
  --text-primary: #1E1710;
  --text-secondary: #3D3225;
  --text-tertiary: #6A5D4B;
  --border-primary: #9E9475;
  --border-secondary: #C2B89C;
  --border-tertiary: #D8D0BE;
  --accent: #5B4DC4;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1B19;
    --bg-secondary: #25252B;
    --bg-card: #1E1E1C;
    --text-primary: #F1EFE8;
    --text-secondary: #B4B2A9;
    --text-tertiary: #82817B;
    --border-primary: #535351;
    --border-secondary: #3A3A37;
    --border-tertiary: #2C2C2A;
    --accent: #AFA9EC;
  }
}
[data-theme="dark"] {
  --bg: #1B1B19;
  --bg-secondary: #25252B;
  --bg-card: #1E1E1C;
  --text-primary: #F1EFE8;
  --text-secondary: #B4B2A9;
  --text-tertiary: #82817B;
  --border-primary: #535351;
  --border-secondary: #3A3A37;
  --border-tertiary: #2C2C2A;
  --accent: #AFA9EC;
}

/* ── Reset & Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text-primary); line-height: 1.5; padding: 1.5rem 1rem 4rem; }

/* ── Layout ── */
.container { max-width: 920px; margin: 0 auto; }
.header { margin-bottom: 1.5rem; }
.header h1 { font-size: 28px; font-weight: 500; margin-bottom: 8px; letter-spacing: -0.01em; }
.header p { font-size: 15px; color: var(--text-secondary); line-height: 1.6; max-width: 700px; }

/* ── Controls ── */
.controls-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.view-toggle { display: flex; gap: 4px; background: var(--bg-secondary); padding: 3px; border-radius: var(--radius-md); border: 0.5px solid var(--border-tertiary); }
.view-btn { padding: 6px 14px; font-size: 13px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; border-radius: 6px; transition: all 0.12s; font-family: inherit; }
.view-btn.active { background: var(--bg-card); color: var(--text-primary); font-weight: 500; box-shadow: 0 0 0 0.5px var(--border-tertiary); }
.order-select { padding: 7px 12px; font-size: 13px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-family: inherit; }
.order-label { font-size: 12px; color: var(--text-tertiary); }

/* ── Tabs ── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { padding: 6px 14px; border-radius: var(--radius-md); border: 0.5px solid var(--border-secondary); font-size: 13px; cursor: pointer; background: transparent; color: var(--text-secondary); transition: all 0.15s; font-family: inherit; }
.tab.active { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--border-primary); font-weight: 500; }
.tab:hover:not(.active) { background: var(--bg-secondary); }

/* ── Legend ── */
.legend { font-size: 12px; color: var(--text-tertiary); margin-bottom: 1.25rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-bar-bg { width: 52px; height: 5px; background: var(--border-tertiary); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.legend-bar-fill { height: 5px; width: 65%; border-radius: 3px; background: var(--accent); display: block; }

/* ── Group Labels ── */
.group-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: 10px; margin-top: 1.75rem; padding-bottom: 6px; border-bottom: 0.5px solid var(--border-tertiary); }
.group-label:first-of-type { margin-top: 0.5rem; }

/* ── Work Cards (dialogues / treatises) ── */
.dialogue-card, .work-card { border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; background: var(--bg-card); }
.dialogue-header, .work-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; user-select: none; transition: background 0.12s; }
.dialogue-header:hover, .work-header:hover { background: var(--bg-secondary); }
.dialogue-title, .work-title { font-size: 15px; font-weight: 500; }
.dialogue-subtitle, .work-subtitle { font-size: 13px; color: var(--text-secondary); }
.chevron { font-size: 12px; color: var(--text-tertiary); transition: transform 0.2s; flex-shrink: 0; }
.chevron.open { transform: rotate(90deg); }
.dialogue-body, .work-body { display: none; padding: 14px 16px 16px; border-top: 0.5px solid var(--border-tertiary); }
.dialogue-body.open, .work-body.open { display: block; }
.title-row, .work-title-block { flex: 1; min-width: 0; }
.meta-row, .work-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ── Badges ── */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }

/* ── Meta Grid ── */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-md); }
.meta-item { font-size: 12px; }
.meta-key { color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; font-weight: 500; margin-bottom: 2px; }
.meta-val { color: var(--text-primary); font-size: 13px; }

/* ── Overview & Sections ── */
.overview { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin: 0 0 16px; }
.sections-title { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 10px; margin-top: 14px; }
.section { margin-bottom: 10px; padding: 12px; border-radius: var(--radius-md); background: var(--bg-secondary); }
.section-header { font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.section-body { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
.section-steph { font-size: 10px; font-family: var(--font-mono); color: var(--accent); margin-bottom: 4px; letter-spacing: 0.02em; }

/* ── Search ── */
.search-bar { width: 100%; padding: 10px 14px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); font-size: 14px; background: var(--bg-card); color: var(--text-primary); margin-bottom: 1rem; outline: none; font-family: inherit; }
.search-bar:focus { border-color: var(--border-primary); }
.no-results { text-align: center; padding: 2rem; font-size: 14px; color: var(--text-tertiary); }
mark { background: rgba(127, 119, 221, 0.2); color: var(--text-primary); padding: 0 2px; border-radius: 2px; }

/* ── Percentage Bar ── */
.pct-bar-wrap { display: flex; align-items: center; gap: 5px; }
.pct-bar-bg { width: 52px; height: 5px; border-radius: 3px; flex-shrink: 0; background: var(--border-tertiary); overflow: hidden; }
.pct-label { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }
.stephanus { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); background: var(--bg-secondary); padding: 1px 6px; border-radius: 4px; }

/* ── Interlocutors Panel ── */
.interlocutors-panel { padding: 1rem 1.25rem; border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); background: var(--bg-card); margin-bottom: 1.5rem; }
.interlocutor { padding: 12px 0; border-bottom: 0.5px solid var(--border-tertiary); }
.interlocutor:last-child { border-bottom: none; }
.interlocutor-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.interlocutor-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.interlocutor-appears { font-size: 12px; color: var(--text-tertiary); margin-top: 5px; }
.interlocutors-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 14px; }
.interlocutors-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); margin-right: 2px; }
.interlocutor-tag { font-size: 12px; padding: 2px 9px; border-radius: 20px; background: var(--bg-secondary); color: var(--text-secondary); border: 0.5px solid var(--border-tertiary); }
.intl-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 8px; }
.intl-tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.tag-historical { background: #CBF0E2; color: #0F6E56; }
.tag-fictional { background: #F5D6E3; color: #993556; }
.tag-school { background: #DDDCFA; color: #534AB7; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-historical { background: #04342C; color: #9FE1CB; }
  :root:not([data-theme="light"]) .tag-fictional { background: #4B1528; color: #F4C0D1; }
  :root:not([data-theme="light"]) .tag-school { background: #26215C; color: #CECBF6; }
}
[data-theme="dark"] .tag-historical { background: #04342C; color: #9FE1CB; }
[data-theme="dark"] .tag-fictional { background: #4B1528; color: #F4C0D1; }
[data-theme="dark"] .tag-school { background: #26215C; color: #CECBF6; }

/* ── Notes ── */
.iamblichus-note { background: var(--bg-secondary); padding: 12px 14px; border-radius: var(--radius-md); font-size: 13px; color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.6; border-left: 3px solid var(--accent); }

/* ── Auth Badges ── */
.auth-badge { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 10px; margin-left: 6px; font-weight: 500; vertical-align: middle; }
.auth-yes { background: #CBF0E2; color: #0F6E56; }
.auth-likely { background: #D8E6FF; color: #3B5FBD; }
.auth-disputed { background: #F5E6C6; color: #854F0B; }
.auth-spurious { background: #E4E1D6; color: #4A4945; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-yes { background: #04342C; color: #9FE1CB; }
  :root:not([data-theme="light"]) .auth-likely { background: #1A244A; color: #9DB8F5; }
  :root:not([data-theme="light"]) .auth-disputed { background: #412402; color: #FAC775; }
  :root:not([data-theme="light"]) .auth-spurious { background: #2C2C2A; color: #B4B2A9; }
}
[data-theme="dark"] .auth-yes { background: #04342C; color: #9FE1CB; }
[data-theme="dark"] .auth-likely { background: #1A244A; color: #9DB8F5; }
[data-theme="dark"] .auth-disputed { background: #412402; color: #FAC775; }
[data-theme="dark"] .auth-spurious { background: #2C2C2A; color: #B4B2A9; }

/* ── Bio Panel ── */
.bio-panel { background: var(--bg-card); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); padding: 0; margin-bottom: 1.75rem; overflow: hidden; }
.bio-panel h2 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.bio-panel p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 8px; }
.bio-panel p:last-child { margin-bottom: 0; }
details.bio-panel > summary { font-size: 15px; font-weight: 500; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; user-select: none; transition: background 0.12s; }
details.bio-panel > summary:hover { background: var(--bg-secondary); }
details.bio-panel > summary::-webkit-details-marker { display: none; }
details.bio-panel > summary::after { content: "▶"; font-size: 12px; color: var(--text-tertiary); transition: transform 0.2s; margin-left: auto; flex-shrink: 0; }
details.bio-panel[open] > summary::after { transform: rotate(90deg); }
details.bio-panel .bio-body { padding: 14px 16px 16px; border-top: 0.5px solid var(--border-tertiary); }

/* ── Bio Timeline ── */
.bio-timeline { position: relative; margin: 16px auto 4px; padding: 0 20px; max-width: 560px; box-sizing: border-box; }
.bio-timeline::before { content: ''; position: absolute; left: 24px; top: 6px; bottom: 6px; width: 2px; background: var(--border-secondary); border-radius: 1px; }
.tl-item { display: grid; grid-template-columns: 10px 1fr; column-gap: 14px; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-secondary); border: 2px solid var(--border-primary); box-sizing: border-box; z-index: 1; grid-row: 1; align-self: center; }
.tl-item.tl-major::before { background: var(--accent); border-color: var(--accent); }
.tl-year, .tl-text, .tl-works { grid-column: 2; }
.tl-year { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); font-family: var(--font-mono); letter-spacing: 0.02em; line-height: 14px; }
.tl-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 3px; }
.tl-text strong { color: var(--text-primary); font-weight: 500; }
.tl-works { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; font-style: italic; }
.tl-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: 8px; margin-top: 16px; text-align: center; }

/* ── Ideas ── */
.ideas-search { width: 100%; padding: 9px 14px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); font-size: 14px; background: var(--bg-card); color: var(--text-primary); margin-bottom: 1.25rem; outline: none; font-family: inherit; }
.ideas-search:focus { border-color: var(--border-primary); }
.ideas-group-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-top: 1.75rem; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 0.5px solid var(--border-tertiary); }
.ideas-group-label:first-of-type { margin-top: 0; }
.ideas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 4px; }
.idea-card { border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); background: var(--bg-card); overflow: hidden; display: flex; flex-direction: column; }
.idea-card-header { padding: 14px 16px 10px; border-bottom: 0.5px solid var(--border-tertiary); background: var(--bg-secondary); }
.idea-card-name { font-size: 14px; font-weight: 500; line-height: 1.35; margin-bottom: 0; }
.idea-card-body { padding: 12px 16px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.idea-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.65; flex: 1; }
.idea-card-dialogues, .idea-card-works { font-size: 11px; color: var(--text-tertiary); border-top: 0.5px solid var(--border-tertiary); padding-top: 8px; margin-top: 2px; }
.idea-card-dialogues strong, .idea-card-works strong { font-weight: 500; color: var(--text-secondary); }

/* ── Theme Toggle ── */
.theme-toggle { position: fixed; top: 1rem; right: 1rem; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-secondary); border: 0.5px solid var(--border-secondary); cursor: pointer; font-size: 16px; z-index: 100; display: flex; align-items: center; justify-content: center; transition: background 0.15s; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.theme-toggle:hover { background: var(--bg-secondary); }

.index-hero { text-align: center; margin-bottom: 2.5rem; padding: 3rem 1rem 0; }
.index-greek { display: block; font-size: 13px; letter-spacing: 0.15em; color: var(--text-tertiary); margin-bottom: 10px; opacity: 0.7; }
.index-hero h1 { font-size: 38px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; margin-bottom: 16px; }
.index-hero p { font-size: 14px; color: var(--text-tertiary); line-height: 1.7; max-width: 480px; margin: 0 auto; }
.index-rule { width: 40px; height: 1.5px; background: var(--border-secondary); margin: 2rem auto 0; border-radius: 1px; }

.index-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-tertiary); margin-bottom: 48px; padding-bottom: 8px; border-bottom: 0.5px solid var(--border-tertiary); }

.author-grid { display: grid; grid-template-columns: 1fr; gap: 14px; max-width: 520px; margin: 0 auto; }

.author-card { display: flex; flex-direction: column; border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); background: var(--bg-card); overflow: hidden; text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s; }
.author-card:hover { border-color: var(--border-primary); box-shadow: 0 6px 20px rgba(0,0,0,0.05); transform: translateY(-2px); }

.author-card-body { padding: 0; display: flex; flex-direction: row; align-items: stretch; flex: 1; }
.author-card-image { aspect-ratio: 1 / 1.618; flex-shrink: 0; overflow: hidden; background: var(--bg-secondary); position: relative; }
.author-card-image img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.author-card-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 20px; }
.author-card-name { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 2px; }
.author-card-dates { font-size: 12px; color: var(--text-tertiary); margin: 0; }
.author-card-arrow { font-size: 15px; color: var(--text-tertiary); transition: transform 0.15s, color 0.15s; margin-left: auto; flex-shrink: 0; }
.author-card:hover .author-card-arrow { transform: translateX(3px); color: var(--accent); }
.author-card--disabled { opacity: 0.45; pointer-events: none; cursor: default; }
.author-card-badge { font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-tertiary); background: var(--bg-secondary); border: none; border-radius: 20px; padding: 3px 10px; margin-left: auto; flex-shrink: 0; white-space: nowrap; }

.index-footer { text-align: center; margin-top: 48px; padding: 2rem 0; border-top: 0.5px solid var(--border-tertiary); }
.index-footer p { font-size: 12px; color: var(--text-tertiary); margin-bottom: 0; }
.index-footer p + p { margin-top: 8px; }
.index-footer a { color: var(--text-tertiary); text-decoration: none; border-bottom: 0.5px solid var(--border-secondary); transition: color 0.2s, border-color 0.2s; }
.index-footer a:hover { color: var(--text-secondary); border-color: var(--border-primary); }

/* ── Mobile Responsive ── */
@media (max-width: 600px) {
  .container { padding: 0; }
  .index-hero { padding: 2rem 0.5rem 0; }
  .index-hero h1 { font-size: 28px; }
  .index-hero p { font-size: 13px; }
  .author-grid { grid-template-columns: 1fr; gap: 12px; }
  .author-card-image { aspect-ratio: 1 / 1.618; }
  .author-card-info { padding: 16px; }
  .theme-toggle { top: 0.75rem; right: 0.75rem; }
}
