/* ============================================================
   PhD Portal — "Research Ledger" theme
   Ink navy + parchment + sage (in-progress) + gold (published)
   ============================================================ */

:root {
  --ink: #1b2a4a;
  --ink-soft: #3a4b6e;
  --parchment: #f7f5ef;
  --parchment-dim: #efece2;
  --sage: #5c7a6b;
  --gold: #b8912b;
  --rust: #a8503a;
  --line: #ddd7c7;
  --text: #26241f;
  --text-muted: #6b6656;
  --white: #ffffff;

  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --radius: 6px;
  --shadow: 0 1px 3px rgba(27, 42, 74, 0.08), 0 1px 2px rgba(27, 42, 74, 0.06);
  --shadow-lg: 0 8px 24px rgba(27, 42, 74, 0.12);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.2;
}

a { color: var(--ink); }
a:hover { color: var(--rust); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6em 1.2em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--ink-soft); color: var(--white); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--parchment-dim); }
.btn-danger { background: transparent; color: var(--rust); border-color: var(--rust); }
.btn-danger:hover { background: var(--rust); color: var(--white); }
.btn-sm { padding: 0.35em 0.8em; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Alerts ---------- */
.alert {
  padding: 0.8em 1em;
  border-radius: var(--radius);
  margin: 0 0 1em;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.alert-success { background: #eaf1ec; color: #345741; border-color: #c3d8c9; }
.alert-error   { background: #f7e9e5; color: var(--rust); border-color: #eecabb; }
.alert-info    { background: #eaeef5; color: var(--ink); border-color: #cdd7ea; }

/* ---------- Landing (public) page ---------- */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(184,145,43,0.08), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(92,122,107,0.10), transparent 45%),
    var(--parchment);
}
.landing-card {
  max-width: 620px;
  text-align: center;
}
.landing-eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--sage);
  font-weight: 700;
  margin-bottom: 0.8em;
}
.landing h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.4em;
}
.landing p.lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2em;
}
.landing .btn { font-size: 1.05rem; padding: 0.75em 1.8em; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.2rem; }
.auth-card label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); display: flex; flex-direction: column; gap: 0.35em; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6em 0.75em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  width: 100%;
}
textarea { resize: vertical; min-height: 90px; font-family: var(--font-body); }
input:focus, textarea:focus, select:focus { border-color: var(--ink-soft); }

/* ---------- Top navigation ---------- */
.topbar {
  background: var(--ink);
  border-bottom: 3px solid var(--gold);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  color: var(--white) !important;
  font-size: 1.25rem;
  text-decoration: none;
  font-weight: 700;
}
.topnav { display: flex; gap: 1.25rem; }
.topnav a {
  color: #d9def0 !important;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.topnav a:hover, .topnav a.active { color: var(--gold) !important; }

/* ---------- Page shell ---------- */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; }

.sitefooter {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1.5rem;
}

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}

/* ---------- Two-column profile (scholar / supervisor) ---------- */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.profile-col h3 {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 0.9em;
}
.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  margin-bottom: 0.9em;
}
.field-row .k { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field-row .v { font-size: 1rem; color: var(--text); word-break: break-word; }

@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* ---------- Status badges ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3em 0.7em;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-not_started { background: #f1ede2; color: var(--text-muted); border-color: var(--line); }
.status-in_progress  { background: #eaf1ec; color: var(--sage); border-color: #c3d8c9; }
.status-published    { background: #fbf3df; color: var(--gold); border-color: #ecdca4; }

/* ---------- Titles list ---------- */
.title-list { display: flex; flex-direction: column; gap: 0.75rem; }
.title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--parchment-dim);
  flex-wrap: wrap;
}
.title-row.is-main { border-left: 4px solid var(--gold); background: #fdf9ee; }
.title-main-text { flex: 1 1 260px; min-width: 0; }
.title-main-text a { text-decoration: none; font-weight: 600; }
.title-main-text .tag-main { font-size: 0.68rem; color: var(--gold); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; display: block; margin-bottom: 0.15em; }
.title-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Forms ---------- */
form.stack { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: flex; flex-direction: column; gap: 0.35em; }
.form-row label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ---------- Chapters (accordion-style) ---------- */
.chapter {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  background: var(--white);
}
.chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--parchment-dim);
  flex-wrap: wrap;
}
.chapter-head h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--ink);
}
.chapter-num {
  font-family: var(--font-display);
  color: var(--sage);
  font-weight: 700;
  margin-right: 0.4em;
}
.chapter-body { padding: 1.1rem; }
.chapter-hint {
  background: #fbf3df;
  border: 1px dashed #ecdca4;
  border-radius: var(--radius);
  padding: 0.75em 1em;
  font-size: 0.85rem;
  color: #6b5518;
  margin-bottom: 0.9em;
}
.chapter-hint strong { color: var(--gold); }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--ink); }

/* ---------- Small helpers ---------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }

/* keywords chips */
.keywords { display: flex; flex-wrap: wrap; gap: 0.4em; margin-top: 0.3em; }
.keyword-chip {
  background: var(--parchment-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2em 0.75em;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
