/* ============================================================
   OXFORD COLOUR SYSTEM
   Primary: Oxford Blue #002147
   Warm: Dusk #C4A29E, Potters Pink #ED9390, Peach #E08D79
   Cool: Mauve #776885, Lilac #D1BDD5
   ============================================================ */
[data-bs-theme="light"] {
  --ox-blue: #002147;
  --ox-blue-rgb: 0, 33, 71;
  --bg: #f8f6f3;
  --bg-sidebar: #f0ece7;
  --bg-panel: #ffffff;
  --text: #1e1c1a;
  --text-2: #555049;
  --text-3: #938c82;
  --dusk: #C4A29E;
  --potters: #ED9390;
  --peach: #E08D79;
  --mauve: #776885;
  --lilac: #D1BDD5;
  --rule: rgba(0, 33, 71, 0.07);
  --rule-accent: rgba(196, 162, 158, 0.4);
  --panel-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
  --nav-active-bg: rgba(0, 33, 71, 0.04);
  --nav-active-border: #002147;
  --link: #002147;
  --link-hover: #776885;
  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
}

[data-bs-theme="dark"] {
  --ox-blue: #5b9bd5;
  --ox-blue-rgb: 91, 155, 213;
  --bg: #131211;
  --bg-sidebar: #1a1816;
  --bg-panel: #1f1d1a;
  --text: #e4dfd6;
  --text-2: #a8a098;
  --text-3: #706860;
  --dusk: #c4a8a2;
  --potters: #e8a09d;
  --peach: #e8a090;
  --mauve: #a08cae;
  --lilac: #c0aac4;
  --rule: rgba(228, 223, 214, 0.06);
  --rule-accent: rgba(196, 168, 162, 0.2);
  --panel-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.03);
  --nav-active-bg: rgba(91, 155, 213, 0.06);
  --nav-active-border: #5b9bd5;
  --link: #5b9bd5;
  --link-hover: #a08cae;
  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* ============================================================
   BASE & TYPOGRAPHY
   ============================================================ */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}
@media (max-width: 991.98px) {
  html { scroll-padding-top: 7rem; }
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 0.98rem;
  background: var(--bg);
  background-image: var(--grain);
  background-size: 256px;
  color: var(--text);
  line-height: 1.75;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Noto Serif', serif;
  line-height: 1.3;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--link-hover); }

::selection {
  background: rgba(var(--ox-blue-rgb), 0.12);
  color: var(--text);
}

.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 9999;
  padding: 0.5rem 1rem; background: #002147; color: #fff;
  font-weight: 500; border-radius: 0 0 0.25rem 0.25rem; text-decoration: none;
}
.skip-link:focus { top: 0; color: #fff; }

/* ============================================================
   OXFORD BRANDED HEADER
   Logo | separator | Bodleian Libraries
   Full-width bar above everything
   ============================================================ */
.ox-header {
  background: #002147;
  padding: 0.45rem 0;
  position: relative;
  z-index: 1030;
}
.ox-header-inner {
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.ox-logo {
  height: 50px;
  width: auto;
  flex-shrink: 0;
  margin-right: 4px;
}
.ox-separator {
  width: 2px;
  height: 42px;
  background: rgba(255,255,255,0.35);
  flex-shrink: 0;
  position: relative;
}
.ox-separator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -3px;
  width: 8px;
  height: 8px;
  transform: translateY(-50%) rotate(45deg);
  background: #002147;
  border: 2px solid rgba(255,255,255,0.35);
}
.bod-logo {
  height: 65px;
  flex-shrink: 0;
  background: transparent;
  filter: invert(0);
}
.hero-portrait {
  width: 135px; height: 135px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--rule-accent);
  flex-shrink: 0;
}

/* ============================================================
   SIDEBAR (desktop)
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  padding: 6.5rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  transition: background 0.4s ease, border-color 0.4s ease;
  z-index: 1010;
}

.sidebar-identity {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule-accent);
}
.sidebar-name {
  font-family: 'Noto Serif', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.sidebar-tagline {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--text-3);
  text-transform: uppercase;
  line-height: 1.5;
}

.side-nav {
  list-style: none; padding: 0; margin: 0;
}
.side-nav li { margin-bottom: 0.15rem; }
.side-nav a {
  display: block;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-2);
  padding: 0.45rem 0.75rem;
  border-radius: 0.25rem;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}
.side-nav a:hover {
  color: var(--link);
  background: var(--nav-active-bg);
}
.side-nav a.active {
  color: var(--link);
  background: var(--nav-active-bg);
  border-left-color: var(--nav-active-border);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-footer .theme-btn {
  background: none;
  border: 1px solid var(--rule);
  color: var(--text-2);
  width: 2rem; height: 2rem;
  border-radius: 0.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sidebar-footer .theme-btn:hover {
  color: var(--dusk); border-color: var(--dusk);
}
.sidebar-footer-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================================
   MOBILE HEADER (below Oxford bar)
   ============================================================ */
.mobile-bar {
  display: none;
  position: sticky; top: 0; z-index: 1020;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  transition: background 0.4s ease;
}
.mobile-bar .mob-brand {
  font-family: 'Noto Serif', serif;
  font-weight: 700; font-size: 1rem;
  color: var(--text); text-decoration: none;
}
.mob-btn {
  background: none; border: 1px solid var(--rule);
  color: var(--text); border-radius: 0.25rem;
  padding: 0.25rem 0.45rem; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .mobile-bar { display: flex; }
  .main-col { margin-left: 0 !important; }
}

/* Offcanvas */
.offcanvas {
  background: var(--bg-sidebar) !important; max-width: 280px;
}
[data-bs-theme="dark"] .offcanvas .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
.oc-nav { list-style: none; padding: 0; margin: 0; }
.oc-nav a {
  display: block; padding: 0.55rem 0;
  font-family: 'Roboto', sans-serif;
  font-weight: 500; font-size: 0.85rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--rule);
}
.oc-nav a:hover { color: var(--link); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-col {
  margin-left: 280px;
  min-height: 100vh;
  padding: 2rem 2rem;
}
@media (max-width: 1199.98px) and (min-width: 992px) {
  .main-col { padding: 2rem 2rem; }
}
@media (max-width: 991.98px) {
  .main-col { padding: 1.5rem 1.25rem; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: 720px;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.hero h1 {
  font-weight: 700;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: 0.3rem;
}
.hero-subtitle {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}
.hero-meta {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.hero-rule {
  width: 3.5rem;
  height: 2px;
  background: var(--dusk);
  border: none;
  margin: 1.5rem 0 0;
  opacity: 1;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.sect {
  max-width: 720px;
  margin-bottom: 3rem;
}

.sect-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
}
.sect-num {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--dusk);
  letter-spacing: 0.06em;
}
.sect-title {
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0;
}

.sect-subtitle {
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0;
}

.sect p {
  color: var(--text-2);
  font-size: 0.98rem;
  line-height: 1.8;
}

/* ============================================================
   ARCHIVE ENTRIES — catalogue style with Oxford colours
   ============================================================ */
.archive-entry {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--dusk);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--panel-shadow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.archive-entry:hover {
  border-left-color: var(--potters);
}

.archive-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.archive-entry h3 {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
}
.archive-code {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--dusk);
  background: rgba(196, 162, 158, 0.1);
  padding: 0.15rem 0.55rem;
  border-radius: 0.2rem;
}
[data-bs-theme="dark"] .archive-code {
  background: rgba(196, 168, 162, 0.08);
}

.archive-date {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 0.6rem;
}

.archive-entry p {
  font-size: 0.93rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.archive-link {
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--link);
  border: 1px solid var(--link);
  padding: 0.4rem 1rem;
  border-radius: 0.2rem;
  transition: all 0.2s ease;
}
.archive-link:hover {
  background: #002147;
  color: #fff;
  border-color: #002147;
}
[data-bs-theme="dark"] .archive-link:hover {
  background: var(--link);
  border-color: var(--link);
  color: #111;
}
.archive-link i {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.archive-link:hover i { transform: translateX(2px); }

/* Side projects — compact */
.side-entry {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--panel-shadow);
  margin-bottom: 0.75rem;
  transition: border-color 0.3s ease;
}
.side-entry:hover { border-color: var(--dusk); }
.side-entry h3 {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.15rem;
}
.side-entry p {
  font-size: 0.88rem;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}

/* ============================================================
   MEMBERSHIPS
   ============================================================ */
.mem-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  color: var(--mauve);
  border: 1px solid var(--mauve);
  background: transparent;
  padding: 0.25rem 0.85rem;
  border-radius: 0.2rem;
  margin: 0.2rem 0.3rem 0.2rem 0;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-panel {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  padding: 2rem;
  box-shadow: var(--panel-shadow);
}
.contact-col h3 {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
  color: var(--link);
}
.contact-list {
  list-style: none; padding: 0; margin: 0;
}
.contact-list li {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.3rem 0; font-size: 0.9rem;
}
.contact-list li i {
  font-size: 0.85rem; color: var(--dusk);
  width: 1rem; text-align: center; flex-shrink: 0;
}
.contact-list li a { color: var(--text-2); }
.contact-list li a:hover { color: var(--link); }

/* ============================================================
   FOOTER / COLOPHON
   ============================================================ */
.colophon {
  max-width: 720px;
  padding: 2rem 0;
  margin-top: 1rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.colophon-logo {
  height: 50px;
  opacity: 0.5;
  margin-bottom: 0.75rem;
}
[data-bs-theme="dark"] .colophon-logo { filter: invert(0.8); }
.colophon p {
  font-family: 'Noto Serif', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-3);
  margin: 0;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.reveal.shown { opacity: 1; transform: translateY(0); }
.reveal.s2 { transition-delay: 0.08s; }
.reveal.s3 { transition-delay: 0.16s; }
.reveal.s4 { transition-delay: 0.24s; }

@media (max-width: 575.98px) {
  .archive-entry { padding: 1.25rem 1.25rem; }
  .contact-panel { padding: 1.25rem; }
  .ox-header-inner { padding: 0 1rem; }
  .ox-logo { height: 40px; }
  .bod-logo { height: 34px; }
  .ox-separator { height: 34px; }
}
