/* ===================== */
/* FONT SETUP (fonts loaded in HTML <head>) */
/* ===================== */
/* no @import here to avoid double-loading */

/* Defensive baseline */
*, *::before, *::after { box-sizing: border-box; }
html { line-height: 1.15; -webkit-text-size-adjust: 100%; }
img, svg, video, canvas, audio, iframe, embed, object { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
svg { fill: currentColor; }

/* ===================== */
/* THEME TOKENS          */
/* ===================== */
:root {
  --max-width: 960px;

  /* LIGHT — refreshed to harmonize with dark mode */
  --bg: #9aafb1;         /* page background */
  --text: #212525;
  --muted: #2B3E47;      /* neutral cool gray for metadata */
  --surface: #CAD2C5;    /* soft cool gray-green content bubbles */
  --surface-2: #22333B;  /* NAVBAR (dark navy, same as dark mode) */
  --nav-text: #F0EBD8;   /* nav/link text on dark bar */
  --border: #B7C2B9;     /* subtle green-gray border */

  /* Accent / brand (muted teal/green tone matching dark mode) */
  --brand: #9aafb1;
  --on-brand: #FFFFFF;

  --radius: 16px;

  /* Very light shadows */
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-hover: 0 2px 6px rgba(0,0,0,.10);
}

html[data-theme="dark"] {
  /* DARK — navy variations with muted earthy tones */
  --bg: #22333B;
  --text: #e9e6dc;
  --muted: #9aafb1;
  --surface: #2B3E47;
  --surface-2: #1B2A31;
  --nav-text: #e9e6dc;
  --border: #324951;
  --brand: #9aafb1;
  --on-brand: #0F1417;
  --shadow: 0 1px 3px rgba(0,0,0,.35);
  --shadow-hover: 0 3px 10px rgba(0,0,0,.35);
}

/* Respect system preference if user hasn't chosen */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) { color-scheme: dark; }
}

/* ===================== */
/* BASE LAYOUT           */
/* ===================== */
body {
  margin: 0;
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding-left: 220px; /* space for sidebar */
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Asap Condensed", "Montserrat", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

main.container { padding: 2rem 1rem; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 1rem 0;
  color: var(--nav-text);
  text-align: center;
  font-family: "Roboto Mono", monospace;
  font-weight: 400;
  font-size: 0.9rem;
  box-shadow: none;
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ===================== */
/* SIDEBAR NAV (DESKTOP) */
/* ===================== */
.navbar {
  position: fixed;
  inset: 0 auto 0 0;     /* left sidebar */
  width: 220px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface-2);     /* darker than page bg */
  border-right: 1px solid var(--border);
  box-shadow: none;
  z-index: 1000;
}

/* optional brand link */
.brand-link {
  font-family: "Asap Condensed", "Montserrat", sans-serif;
  font-weight: 400;
  text-decoration: none;
  color: var(--nav-text);
  margin-bottom: 6px;
}
.brand-link:hover { opacity: .9; }

/* vertical link list */
.navbar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  background: transparent;
}

.navbar a {
  display: block;
  text-decoration: none;
  color: var(--nav-text);
  font-family: "Asap Condensed", "Montserrat", sans-serif;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background .2s, color .2s, box-shadow .2s;
}

/* Active state = brand chip with readable text */
.navbar a.active {
  background: var(--brand);
  color: var(--on-brand);
}

/* Hover only for NON-active links (muted tint) */
.navbar a:hover:not(.active) {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  box-shadow: none;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .navbar a:hover:not(.active) { background: rgba(89,131,146,0.18); }
}

/* Prevent hover change on active item */
.navbar a.active:hover {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: none;
}

/* ===================== */
/* THEME TOGGLE          */
/* ===================== */
.theme-toggle {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--nav-text);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 999px;
}

/* Track */
.tgl-track {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background .2s ease, border-color .2s ease;
}

/* Thumb (slides left/right) */
.tgl-thumb {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  transform: translate(0, -50%);                 /* left by default (light) */
  transition: transform .25s ease, background .25s ease;
}

html[data-theme="dark"] .tgl-thumb {
  transform: translate(32px, -50%);              /* slide right in dark */
  background: var(--brand);
}

/* Track icons */
.tgl-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: color-mix(in srgb, var(--nav-text) 70%, transparent);
  opacity: .9;
  line-height: 0;
}
.tgl-icon svg { display: block; }

.tgl-icon--sun  { left: 9px; }
.tgl-icon--moon { right: 9px; }

/* ===================== */
/* BUTTONS               */
/* ===================== */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 400;
  border: 1px solid var(--brand);
  font-family: "Asap Condensed", sans-serif;
  box-shadow: none;
}
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { filter: brightness(0.96); }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: rgba(0,0,0,.04); }
html[data-theme="dark"] .btn--ghost:hover { background: rgba(255,255,255,.08); }

/* ===================== */
/* INTRO / ABOUT CARD */
/* ===================== */
.intro {
display: grid;
grid-template-columns: 1.2fr .8fr;
gap: 28px;
padding: 24px;
background: var(--surface); /* off-white bubble */
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: none;
margin: 28px 0 12px;
}

.intro__title {
font-family: "Asap Condensed", sans-serif;
margin: 0 0 .25rem;
font-size: clamp(28px, 4vw, 40px);
line-height: 1.2;
}
.intro__blurb {
font-family: "Montserrat", sans-serif;
color: var(--muted);
margin: 0 0 12px;
}

.intro__contacts {
list-style: none;
padding: 0;
margin: 0 0 12px;
color: var(--text);
font-family: "Roboto Mono", monospace;
font-size: 0.9rem;
}
.intro__contacts li { margin: 4px 0; }

.intro__contacts a {
color: var(--text);
text-decoration: none;
transition: color 0.2s, text-decoration 0.2s;
}
.intro__contacts a:hover {
color: var(--brand);
text-decoration: underline;
}

.intro__image img {
width: 120%;
height: 120;
max-height: 320px;
object-fit: cover;
border-radius: 14px;
box-shadow: var(--shadow);
display: block;
}

/* ===================== */
/* SOCIAL ICONS          */
/* ===================== */
.social-icons {
  display: flex;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.social-icons a:hover {
  transform: translateY(-2px);
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

/* ===================== */
/* SECTIONS / CARDS      */
/* ===================== */
.section-title {
  text-align: center;
  margin: 40px 0 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: "Asap Condensed", sans-serif;
  color: var(--muted);
}

.cards {
  list-style: none; padding: 0; margin: 0 0 40px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.card  {
  background: var(--surface);     /* off-white bubbles */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
}
.card__link { text-decoration: none; color: inherit; display: block; }
.card__thumb { width: 100%; height: 160px; object-fit: cover; }
.card__body { padding: 12px 14px 16px; }
.card__title { margin: 0 0 4px; font-size: 1.05rem; font-family: "Asap Condensed", sans-serif; }
.card__meta { margin: 0 0 8px; color: var(--muted); font-family: "Roboto Mono", monospace; }
.card__summary { margin: 0; color: color-mix(in srgb, var(--text) 85%, transparent); font-family: "Montserrat", sans-serif; }
html[data-theme="dark"] .card__summary { color: var(--text); }

/* ===================== */
/* PROJECT LIST (legacy) */
/* ===================== */
.project-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 16px; }
.project-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); transition: box-shadow .15s ease, transform .1s ease; box-shadow: none; }
.project-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.project-link { display: grid; grid-template-columns: 120px 1fr; gap: 12px; text-decoration: none; color: inherit; }
.project-thumb { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; }
.project-meta .muted { color: var(--muted); font-weight: 400; font-family: "Roboto Mono", monospace; }
.project-meta .summary { color: color-mix(in srgb, var(--text) 85%, transparent); margin-top: 4px; font-family: "Montserrat", sans-serif; }
html[data-theme="dark"] .project-meta .summary { color: var(--text); }

/* ===================== */
/* CV / PDF VIEWER       */
/* ===================== */
.cv-wide { max-width: min(1300px, 100%); margin: 0 auto; }

.pdf-viewer {
  display: block;
  width: 100%;
  height: 100vh;           /* show a full page */
  min-height: 100vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

@media (max-width: 900px) {
  .pdf-viewer { height: calc(100vh - 260px); }
}

/* ===================== */
/* RESPONSIVE            */
/* ===================== */
@media (max-width: 900px) {
  body { padding-left: 0; } /* collapse sidebar */
  .navbar {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .navbar ul {
    flex-direction: row;
    gap: 16px;
    background: var(--surface-2);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: none;
    flex: 1;
  }

  .intro { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ===================== */
/* HOME: ABOUT ME SECTION */
/* ===================== */
.about-me {
  background: var(--surface);    /* off-white */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 32px;
  margin-top: 40px;
}

.about-me h2 {
  margin-top: 0;
  font-size: 1.6rem;
  text-align: left;
  font-family: "Asap Condensed", sans-serif;
  color: var(--muted);
}

.about-me__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  align-items: start;
  margin-top: 16px;
}

.about-me__text p {
  margin-bottom: 1rem;
  color: var(--text);
  font-family: "Montserrat", sans-serif;
}

.about-me__image img {
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: block;
}

@media (max-width: 800px) {
  .about-me__grid { grid-template-columns: 1fr; }
  .about-me__image img { margin: 0 auto; }
}
/* ===================== */
/* CV: Responsive Behavior */
/* ===================== */

.cv-mobile { display: none; }

/* Improve embedded height handling across mobile browsers */
.pdf-viewer {
  display: block;
  width: 100%;
  height: 100vh;       /* desktop */
  min-height: 100vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

/* Small screens: hide iframe, show native-open button */
@media (max-width: 900px) {
  .cv-wide   { display: none; }
  .cv-mobile { display: block; }

  /* Use dynamic viewport units so iOS toolbars don't chop height */
  .pdf-viewer { height: 100svh; min-height: 100svh; }
}

/* Optional: a tiny note style under the button */
.cv-mobile p {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 0.95rem;
}
/* Project page content */
.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 24px;
}

.project header { margin-bottom: 12px; }
.project h1 { margin: 0 0 6px; }
.project p, .project li { color: var(--text); }
.project a { color: var(--brand); text-decoration: underline; }
.project a:hover { filter: brightness(0.95); }
.project img, .project-thumb { border-radius: 12px; }
.project code { background: color-mix(in srgb, var(--text) 8%, transparent); padding: .1em .3em; border-radius: 4px; }

/* ===== Expandable project cards (My Work) ===== */

.project-list--expandable .project-card {
  transition: box-shadow .18s ease, transform .12s ease, border-color .18s ease;
}

.project-list--expandable .project-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

/* Use a button as the main row */
.project-list--expandable .project-toggle {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  text-align: left;

  display: grid;
  grid-template-columns: 260px 1fr;   /* bigger thumbnail */
  gap: 16px;
  padding: 16px;
  cursor: pointer;
}

@media (max-width: 700px) {
  .project-list--expandable .project-toggle {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* Bigger thumbnail */
.project-list--expandable .project-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

/* Title/Meta */
.project-list--expandable .project-title {
  display: block;
  font-family: "Asap Condensed", sans-serif;
  font-size: 1.15rem;
  margin-bottom: 2px;
}

/* Teaser summary (visible when collapsed) */
.project-list--expandable .summary--teaser {
  color: color-mix(in srgb, var(--text) 80%, transparent);
  margin-top: 6px;
}

/* Details panel (hidden by default) */
.project-list--expandable .project-details {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

.project-list--expandable .project-details__inner {
  padding: 16px;
}

.project-list--expandable .summary--full {
  margin: 0 0 8px;
  color: var(--text);
}

.project-list--expandable .project-body > *:first-child { margin-top: 0; }
.project-list--expandable .project-body > *:last-child  { margin-bottom: 0; }

.project-list--expandable .project-actions {
  margin: 14px 0 4px;
}

/* Open state accent */
.project-list--expandable .project-card.is-open {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: var(--shadow-hover);
}
/* ===== Expandable project cards: authors + layout ===== */

.project-list--expandable .project-card {
  transition: box-shadow .18s ease, transform .12s ease, border-color .18s ease;
}
.project-list--expandable .project-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.project-list--expandable .project-toggle {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  text-align: left;

  display: grid;
  grid-template-columns: 260px 1fr;   /* bigger thumbnail */
  gap: 16px;
  padding: 16px;
  cursor: pointer;
}
@media (max-width: 700px) {
  .project-list--expandable .project-toggle {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

.project-list--expandable .project-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.project-list--expandable .project-title {
  display: block;
  font-family: "Asap Condensed", sans-serif;
  font-size: 1.15rem;
  margin-bottom: 2px;
}

.project-authors {
  font-family: "Roboto Mono", monospace;
  font-size: .95rem;
  color: var(--muted);
  margin-top: 4px;
}
html[data-theme="dark"] .project-authors { color: color-mix(in srgb, var(--text) 80%, transparent); }

.project-list--expandable .summary--teaser {
  color: color-mix(in srgb, var(--text) 80%, transparent);
  margin-top: 6px;
}

/* Details panel */
.project-list--expandable .project-details {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.project-list--expandable .project-details__inner { padding: 16px; }

.project-list--expandable .summary--full {
  margin: 0 0 8px;
  color: var(--text);
}
.project-authors--full {
  margin: 0 0 10px;
}

.project-list--expandable .project-actions { margin: 14px 0 4px; }

.project-list--expandable .project-card.is-open {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: var(--shadow-hover);
}
/* ===== Fix: Project Titles in Dark Mode ===== */
html[data-theme="dark"] .project-list--expandable .project-title {
  color: var(--text);
}

html[data-theme="dark"] .project-list--expandable .project-authors,
html[data-theme="dark"] .project-list--expandable .summary--teaser,
html[data-theme="dark"] .project-list--expandable .summary--full {
  color: color-mix(in srgb, var(--text) 90%, transparent);
}
/* iOS title color normalize for project cards */
.project-list--expandable .project-title,
.project-list--expandable .project-title a {
  color: var(--text) !important;
  text-decoration: none;
}
.project-list--expandable .project-title a:visited {
  color: var(--text) !important;
}

/* Ensure the toggle (a <button>) inherits text color on iOS */
.project-list--expandable .project-toggle {
  -webkit-appearance: none; /* iOS Safari */
  appearance: none;
  color: inherit;
}

/* Belt & suspenders: make buttons inherit color globally */
button {
  color: inherit;
}

/* If any card used links for the header/title elsewhere */
.card__title a {
  color: var(--text) !important;
  text-decoration: none;
}
.card__title a:visited {
  color: var(--text) !important;
}
/* ===== Other Things: expandable grid ===== */

.other-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 1000px) {
  .other-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .other-grid { grid-template-columns: 1fr; }
}

.other-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
  transition: box-shadow .18s ease, transform .12s ease, border-color .18s ease;
}
.other-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }

.other-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  color: inherit;
}

.other-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
}

.other-meta {
  display: flex;
  flex-direction: column;
}
.other-title {
  font-family: "Asap Condensed", sans-serif;
  font-size: 1.05rem;
  margin-bottom: 2px;
  color: var(--text);
}
html[data-theme="dark"] .other-title { color: var(--text); }

.other-tags {
  font-family: "Roboto Mono", monospace;
  font-size: .9rem;
  color: var(--muted);
}

/* Expanded panel */
.other-details {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.other-details__inner { padding: 14px; }

.other-actions { margin: 12px 0 2px; }

.other-card.is-open {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: var(--shadow-hover);
}

/* iOS color normalize for titles */
.other-title,
.other-title a {
  color: var(--text) !important;
  text-decoration: none;
}
.other-title a:visited { color: var(--text) !important; }
