/* RuneCodex shared stylesheet — "arcane codex" theme: warm parchment, ink text,
   antique gold ornament, deep violet actions. Mobile-first, desktop-enhanced. */

:root {
  --parchment: #faf6ec;
  --parchment-deep: #f1e8d2;
  --surface: #fffdf7;
  --ink: #26221a;
  --ink-soft: #4d4636;
  --muted: #7a7261;
  --border: #e0d3b6;
  --gold: #a37e22;
  --gold-soft: #f4e9c9;
  --arcane: #4b3575;
  --arcane-deep: #35245a;
  --arcane-soft: #eee8fa;
  --success: #2f7a3d;
  --danger: #b3372c;
  --radius: 12px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --shadow: 0 2px 10px rgba(75, 53, 117, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--parchment);
  background-image: radial-gradient(1200px 500px at 50% -120px, rgba(163, 126, 34, 0.10), transparent 70%);
  line-height: 1.65;
  font-size: 16px;
}
a { color: var(--arcane); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 246, 236, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(163, 126, 34, 0.25);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 1.7rem; font-weight: 700;
  color: var(--ink); letter-spacing: 0.02em; line-height: 1;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; color: var(--gold); flex: none; }
.brand em { font-style: normal; color: var(--arcane); }
.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--ink-soft); font-size: 0.95rem; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.main-nav a:hover { text-decoration: none; background: var(--gold-soft); color: var(--ink); }
.main-nav a.active { background: var(--arcane); color: #fff; }
.main-nav a.donate-link {
  border: 1px solid var(--gold); color: var(--gold);
  margin-left: 6px; font-weight: 600;
}
.main-nav a.donate-link:hover { background: var(--gold); color: #fff; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 64px 0 40px; position: relative; }
.eyebrow {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.4rem, 5.5vw, 3.8rem);
  line-height: 1.12; margin: 0 0 16px; color: var(--ink);
  text-wrap: balance;
}
.hero p.lede, .hero > p {
  font-size: 1.12rem; color: var(--ink-soft);
  max-width: 640px; margin: 0 auto;
}
.hero .rune-watermark {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  width: 190px; height: 190px; color: var(--gold); opacity: 0.10;
  pointer-events: none;
}

/* Gold ornament divider: — ❖ — */
.ornament {
  display: flex; align-items: center; gap: 12px;
  color: var(--gold); margin: 34px auto; max-width: 420px;
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.ornament::after { background: linear-gradient(90deg, var(--gold), transparent); }
.ornament span { font-size: 0.9rem; line-height: 1; }

/* ---------- Sections ---------- */
.section { padding: 8px 0 40px; }
.section h2, .cross-promo h2 {
  font-family: var(--display); font-size: 2rem; font-weight: 700;
  margin: 0 0 6px; text-align: center;
}
.section .lede { text-align: center; color: var(--muted); margin: 0 0 26px; }

/* ---------- Tool cards ---------- */
.tool-grid {
  display: grid; gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
a.tool-card-link { color: inherit; }
a.tool-card-link:hover { text-decoration: none; }
.tool-card.live:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(75, 53, 117, 0.14); }
.tool-card h3 { font-family: var(--display); font-size: 1.45rem; margin: 0; }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; flex: 1; }
.tool-card .go { font-weight: 600; color: var(--arcane); }
.badge {
  align-self: flex-start; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--arcane); color: #fff;
  padding: 4px 12px; border-radius: 999px;
}
.badge.soon { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.tool-card.soon { opacity: 0.85; }

/* ---------- Breadcrumb ---------- */
.crumbs { font-size: 0.88rem; color: var(--muted); padding-top: 22px; }
.crumbs a { color: var(--arcane); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 0.98rem;
  padding: 11px 22px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--arcane); border-color: var(--arcane); color: #fff; }
.btn-primary:hover { background: var(--arcane-deep); border-color: var(--arcane-deep); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: #8a6719; border-color: #8a6719; color: #fff; }
.btn-small { padding: 7px 14px; font-size: 0.88rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Pills ---------- */
.pill-group { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  font: inherit; font-size: 0.95rem; font-weight: 500;
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
}
.pill:hover { border-color: var(--gold); }
.pill[aria-pressed="true"] { background: var(--arcane); border-color: var(--arcane); color: #fff; font-weight: 600; }

/* ---------- Tool page layout (desktop: form + sticky sidebar) ---------- */
.tool-layout { display: grid; gap: 26px; grid-template-columns: 1fr; padding-bottom: 10px; }
@media (min-width: 960px) {
  .tool-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .tool-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 26px; }
}
.tool-side { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

/* ---------- Form ---------- */
.form-card, .result-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; background: var(--surface);
  box-shadow: var(--shadow);
}
.form-card h2, .result-card h2 {
  font-family: var(--display); font-size: 1.5rem; margin: 0 0 14px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.field input[type="text"], .field input[type="url"], .field input[type="number"], .field select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--arcane-soft); border-color: var(--arcane);
}
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field-error { color: var(--danger); font-size: 0.88rem; margin-top: 4px; display: none; }
.field.invalid input { border-color: var(--danger); }
.field.invalid .field-error { display: block; }
.sub-label {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem; font-weight: 700; color: var(--ink);
  margin: 18px 0 8px;
}
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 0.92rem; }
.checkbox-row input { margin-top: 4px; accent-color: var(--arcane); }
.author-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-bottom: 10px; align-items: center; }
.author-row .btn-small { white-space: nowrap; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* ---------- Result / citation ---------- */
.citation {
  font-size: 1.02rem; line-height: 1.7;
  padding-left: 2em; text-indent: -2em; /* hanging indent */
  background: var(--parchment); border-left: 3px solid var(--gold);
  padding-top: 14px; padding-bottom: 14px; padding-right: 16px;
  border-radius: 0 8px 8px 0; margin: 6px 0;
  overflow-wrap: break-word;
}
.bib-item { margin-bottom: 18px; }
.bib-item:last-child { margin-bottom: 6px; }
.bib-actions { display: flex; gap: 10px; margin-top: 8px; }
.empty-note { color: var(--muted); font-style: italic; }

/* URL metadata lookup */
.lookup-row .hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }
.lookup-status { font-size: 0.88rem; margin-top: 8px; min-height: 1.3em; color: var(--muted); }
.lookup-status.ok { color: var(--success); }
.lookup-status.err { color: var(--danger); }

/* ---------- Guide / FAQ ---------- */
.guide { padding: 20px 0 40px; max-width: 780px; margin: 0 auto; }
.guide h2 { font-family: var(--display); font-size: 1.9rem; margin: 34px 0 12px; }
.guide h3 { font-family: var(--display); font-size: 1.45rem; margin: 28px 0 10px; color: var(--arcane-deep); }
.guide p, .guide li { color: var(--ink-soft); }
.guide ol, .guide ul { padding-left: 1.4em; }
.guide li { margin-bottom: 8px; }
.faq { margin-top: 30px; }
.faq dt { font-weight: 700; margin-top: 16px; color: var(--ink); }
.faq dd { margin: 4px 0 0; color: var(--ink-soft); }

/* ---------- Donate strip ---------- */
.donate-strip {
  background: linear-gradient(135deg, var(--arcane-deep), var(--arcane));
  color: #f4eedd; border-radius: 16px;
  padding: 44px 32px; text-align: center; margin: 30px 0 50px;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 30px rgba(53, 36, 90, 0.25);
}
.donate-strip::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 50% -60px, rgba(163, 126, 34, 0.35), transparent 70%);
  pointer-events: none;
}
.donate-strip h2 { font-family: var(--display); font-size: 1.9rem; margin: 0 0 10px; color: #fff; position: relative; }
.donate-strip p { margin: 0 0 22px; color: #d9cfb8; max-width: 520px; margin-left: auto; margin-right: auto; position: relative; }
.donate-strip .btn { position: relative; }

/* ---------- Cross-promo ---------- */
.cross-promo {
  border-top: 1px solid var(--border);
  background: var(--parchment-deep);
  padding: 44px 0 54px; margin-top: 10px;
}
.cross-promo .lede { text-align: center; color: var(--muted); margin: 0 0 26px; }
.cross-promo .all-link { text-align: center; margin-top: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 40px; color: var(--muted); font-size: 0.9rem;
}
.site-footer .container {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap;
}
.site-footer .foot-brand { font-family: var(--display); font-size: 1.25rem; color: var(--ink); font-weight: 700; }
.site-footer .foot-tag { margin: 4px 0 0; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--ink-soft); }

/* ---------- Small screens ---------- */
@media (max-width: 639px) {
  .site-header .container { flex-direction: column; gap: 8px; padding-top: 10px; }
  .hero { padding: 44px 0 28px; }
  .form-card, .result-card { padding: 20px; }
  .author-row { grid-template-columns: 1fr 1fr; }
  .author-row .btn-small { grid-column: 1 / -1; justify-self: start; }
  .field-row-3 { grid-template-columns: 1fr; }
}

/* ---------- GPA calculator ---------- */
.hint { color: var(--muted); font-size: 0.9rem; }
.course-row {
  display: grid; grid-template-columns: 1fr 90px 84px 118px 38px; gap: 10px;
  margin-bottom: 10px; align-items: center;
}
.sem-row {
  display: grid; grid-template-columns: 1fr 110px 110px 38px; gap: 10px;
  margin-bottom: 10px; align-items: center;
}
.sem-row input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; width: 100%;
}
.sem-row input:focus {
  outline: none; border-color: var(--arcane); box-shadow: 0 0 0 3px var(--arcane-soft);
}
.course-row input, .course-row select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; width: 100%;
}
.course-row input:focus, .course-row select:focus {
  outline: none; border-color: var(--arcane); box-shadow: 0 0 0 3px var(--arcane-soft);
}
.row-remove {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 8px; width: 38px; height: 42px; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.row-remove:hover { color: var(--danger); border-color: var(--danger); }
.gpa-big {
  font-family: var(--display); font-size: 3.4rem; font-weight: 700; color: var(--arcane-deep);
  line-height: 1.1; margin: 4px 0 8px;
}
.gpa-sub { color: var(--muted); font-size: 0.92rem; margin: 0; }
.grade-table { border-collapse: collapse; margin: 12px 0 18px; }
.grade-table th, .grade-table td {
  border: 1px solid var(--border); padding: 6px 16px; text-align: center;
}
.grade-table th { background: var(--gold-soft); font-family: var(--display); }
@media (max-width: 639px) {
  .course-row { grid-template-columns: 1fr 1fr; }
  .course-row .course-name { grid-column: 1 / -1; }
  .sem-row { grid-template-columns: 1fr 1fr; }
  .sem-row .sem-name { grid-column: 1 / -1; }
  .row-remove { width: 100%; }
}
