/* =======================================================================
   Base variables
   ======================================================================= */
:root{
  --brand: #0b27f4;
  --brand-soft: rgba(242, 205, 12, 0.28);
  --text:  #202124;
  --bg:    #faf9f5;
  --surface: #ffffff;
  --surface-alt: #f3f4f6;
  --border: #e0e0e0;
  --muted: #5f6368;
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-soft: 0 2px 6px rgba(0,0,0,.06);
  --shadow-hover: 0 8px 20px rgba(0,0,0,.12);
  --maxw:  880px;     /* site content width */
  --radius: 10px;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "DM Serif Display", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after{ box-sizing: border-box; }

html, body{
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

body{
  transition: background-color .3s ease, color .3s ease;
}

h1,h2,h3{
  font-family: var(--font-heading);
}

img{ max-width: 100%; display: block; }

section{ padding: 3.5rem 1rem; }
h1,h2,h3{ margin: 0 0 .5em; }
h2{ border-bottom: 4px solid var(--brand); display: inline-block; }

a{ color: var(--brand); }
a:hover{ text-decoration: underline; }

button,
input,
select{ font-family: inherit; }

/* Lessen the big top padding on every section except the first */
section:not(:first-of-type){ padding-top: 1.5rem; }  /* was 3.5rem */


/* =======================================================================
   Header & navigation (stable + centered to --maxw)
   ======================================================================= */
.site-header{
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* center the inner content to match main column */
  padding-left: max(1rem, calc((100vw - var(--maxw)) / 2));
  padding-right: max(1rem, calc((100vw - var(--maxw)) / 2));
  padding-top: .75rem; padding-bottom: .75rem;
}

.logo{
  font-size: 1.2rem; color: var(--brand);
  white-space: nowrap; line-height: 1; margin: 0;
  flex: 0 0 auto;
}

.logo a{
  color: inherit;
  text-decoration: none;
}

#siteNav{
  margin-left: auto;               /* nav pinned to the right edge of the centered column */
  display: flex; align-items: center; gap: 1.1rem;
  white-space: nowrap; flex: 0 0 auto;
}
#siteNav a{
  text-decoration: none; color: var(--text); font-weight: 500;
}
#siteNav a:hover{ color: var(--brand); text-decoration: none; }
#siteNav a.active{ color: var(--brand); font-weight: 600; }

.hamburger{
  display: none;
  background: none;
  border: 0;
  font-size: 1.35rem;
  margin-left: .75rem;
  color: var(--text);
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
}
.hamburger:hover,
.hamburger:focus-visible{ color: var(--brand); }
.hamburger[aria-expanded="true"]{ color: var(--brand); }

/* =======================================================================
   Theme lab controls
   ======================================================================= */
.theme-lab{
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

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

.theme-lab__summary{
  display: flex;
  flex-direction: column;
  gap: .2rem;
  list-style: none;
  padding: 1.4rem 0;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  padding-right: 2rem;
}

.theme-lab__summary::marker{ display: none; }

.theme-lab__summary::after{
  content: '';
  position: absolute;
  right: .4rem;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
  width: .6rem;
  height: .6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform-origin: center;
  transition: transform .2s ease;
}

.theme-lab__panel[open] .theme-lab__summary::after{
  transform: translateY(-50%) rotate(45deg);
}

.theme-lab__summary:focus-visible{
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 8px;
}

.theme-lab__summary-title{ font-size: 1.05rem; }

.theme-lab__summary-hint{
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
}

.theme-lab__panel[open] .theme-lab__summary{
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.theme-lab__inner{
  padding-bottom: 2.2rem;
  display: grid;
  gap: 1.75rem;
}

.theme-lab__intro h2{
  border: 0;
  display: block;
  margin-bottom: .35rem;
}

.theme-lab__intro p{
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
}

.theme-lab__controls{
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.theme-control{
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.theme-control label{
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-control input[type="color"]{
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0;
  cursor: pointer;
}

.theme-control select{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: .55rem .75rem;
  font-size: .95rem;
  box-shadow: var(--shadow-soft);
}

.theme-control button{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: .55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .2s ease;
}

.theme-control button:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.theme-control--wide{ grid-column: 1 / -1; }


.theme-help{
  grid-column: 1 / -1;
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}

@media (max-width: 640px){
  .theme-lab__panel{ padding: 0 .75rem; }
  .theme-lab__inner{ padding-bottom: 1.8rem; }
  .theme-control label{ letter-spacing: .05em; }
}

/* =======================================================================
   Hero (two columns aligned to --maxw)
   ======================================================================= */
.hero{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4rem 1rem 2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 4rem;
  scroll-margin-top: 80px;
  padding-bottom: 1rem;
}

.hero-text{ min-width: 220px; text-align: left; }

/* =======================================================================
   Publications & Projects blocks
   ======================================================================= */
#publications, #projects{ max-width: var(--maxw); margin: 0 auto; }

.pub-list{ list-style: none; padding: 0; }
.pub-list li{ margin-bottom: 1rem; }

#projects .projects-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.project-quadrant{
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .2s, box-shadow .2s;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.project-quadrant:hover,
.project-quadrant:focus-visible{
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  outline: none;
}
.project-quadrant img{ width: 100%; height: auto; }
.project-quadrant .project-info{ padding: 1rem; }

.see-all a{ display: inline-block; margin-top: .5rem; font-weight: 500; text-decoration: none; }

/* ====== Project Images*/

/* new patch */

/* Center the Projects section like the home page (keep if you already have it) */
#projects{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Project card look (matches home tiles’ vibe, no hover) */
.project{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 1.25rem 0 2.25rem;   /* space between projects */
  overflow: visible;
}

/* Header row with the title + toggle */
.project-header{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

/* Title pushes the rest to the right */
.project-header > h3 { margin-right: auto; }


.project-toggle{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  width: 32px; height: 32px;      /* fixed */
  display:grid; place-items: center;
  cursor: pointer;
}

/* Optional: small “playing” affordance */
.speak-btn.playing{
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: var(--shadow-hover);
}

/* Collapsed by default; expands when the card has .open */
.project-content{ display: none; padding: 1rem 1.1rem 1.25rem; }
.project.open .project-content{ display: block; }

/* Two images side by side, bigger and sharp */


.project-images{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: .5rem 0 1.1rem;
  --img-ar: 1/1;              /* default aspect ratio (square) */
  --img-pos: 50% 50%;         /* default crop centre */
}
.project-images img{
  width: 100%;
  aspect-ratio: var(--img-ar); /* gives you consistent boxes without hardcoding height */
  height: auto;
  object-fit: cover;
  object-position: var(--img-pos);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}


/* Keep readable on phones */
@media (max-width: 640px){
  .project-images{ grid-template-columns: 1fr; }
}

/* =======================================================================
   Device cards (devices.html)
   ======================================================================= */
.portfolio{ max-width: var(--maxw); margin: 0 auto; padding: 2rem 1rem 4rem; }
.device{ display: grid; grid-template-columns: 260px 1fr; gap: 1rem; border:1px solid var(--border); border-radius: 8px; overflow:hidden; background:var(--surface); margin-bottom:1.25rem; }
.device-img{ width:100%; height:100%; object-fit:cover; }
.device-body{ padding:1rem; }
.device-links a{ color: var(--brand); text-decoration:none; }
.device-links a:hover{ text-decoration:underline; }

/* =======================================================================
   Octagonal frame around the profile image
   ======================================================================= */
.flash-wrapper{
  position: relative;
  width: 300px; height: 300px;       /* container that holds both the frame and the image */
}

.flash-wrapper::before{
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 230px; height: 230px;       /* outer octagon size */
  border: 4px solid var(--brand);    /* frame thickness & colour */
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border-radius: 4px;                 /* slightly soften corners */
  background: transparent;
  pointer-events: none;
  box-sizing: border-box;
}

/* Circular image centered inside the frame with a clear gap */
.flash-img{
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 165px; height: 165px;       /* smaller than octagon to create the gap */
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}

/* Tagline sits under the frame */
.gif-tagline{
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  margin: 0; padding-top: .25rem;
  text-align: center; font-size: 1rem; color: var(--text);
  width: 100%;
}

/* READ ALONG */

/* Speaker icon */
.speak-btn{
  position: relative; display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; margin-left:.5rem;
  border:1px solid var(--border); background:var(--surface); border-radius:10px; cursor:pointer;
  box-shadow:var(--shadow-soft);
  color: var(--text);
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.speak-btn:hover,
.speak-btn:focus-visible{
  border-color: var(--brand);
  box-shadow: var(--shadow-hover);
}
.speak-btn .icon{ font-size:22px; line-height:1; color: inherit; }

/* Cloud-y tooltip bubble */
.speak-btn .bubble{
  z-index: 1000;
  position:absolute; top:-64px; right:-6px; padding:.5rem .75rem; white-space:nowrap;
  background:var(--surface); border:1px solid var(--border); border-radius:40% 60% 60% 40%/40% 40% 60% 60%;
  box-shadow:var(--shadow-soft); font-size:.9rem;
  opacity:0; transform:translateY(6px); pointer-events:none; transition:opacity .15s, transform .15s;
}
.speak-btn:hover .bubble, .speak-btn:focus-visible .bubble{ opacity:1; transform:translateY(0); }

/* Read-along highlight */
.readable .hl{
  background:var(--brand-soft); box-shadow:0 0 0 2px var(--brand-soft); border-radius:4px;


}

/* Inline emphasis */
.u {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

/* Optional text highlight */
mark {
  background: var(--brand-soft);
  padding: 0 .1em;
  border-radius: .2em;
}

/* Lists inside project content */
.project-content .bullets {
  margin: .75rem 0 1rem;
  padding-left: 1.2rem;   /* controls indent */
}
.project-content .bullets li { margin: .25rem 0; }

/* Links: keep clearly underlined for accessibility */
.project-content a { text-decoration: underline; }
.project-content a:hover { text-underline-offset: .18em; }

/* Compact the "Personalise the theme" bar */
section.theme-lab{            /* shrink the whole bar */
  padding: .6rem 0;           /* was 3.5rem 1rem via section{} */
}

.theme-lab__summary{          /* shrink the clickable summary row */
  padding: .6rem 0;           /* was 1.4rem 0 */
  font-size: .95rem;
  padding-right: 1.5rem;      /* tighten arrow spacing */
}

.theme-lab__summary-title{    /* slightly smaller heading */
  font-size: 1rem;            /* was 1.05rem */
}

.theme-lab__summary-hint{     /* optional: smaller hint line */
  font-size: .8rem;           /* was .85rem */
}

.theme-lab__summary::after{   /* smaller chevron */
  right: .25rem;
  width: .5rem;
  height: .5rem;
}

.theme-lab__panel[open] .theme-lab__summary{
  margin-bottom: .75rem;      /* was 1.5rem */
}

/* ========== Sticky left icon menu ========== */
.side-nav{
  position: fixed;
  left: clamp(8px, 2vw, 18px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  /* keep it subtle against your background */
  pointer-events: none; /* links re-enable pointer events below */
}

.side-nav ul{ list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }

.side-nav__link{
  --size: 38px;                /* icon button size */
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  pointer-events: auto;        /* re-enable clicking */
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.side-nav__link svg{
  width: 22px; height: 22px;
  stroke: var(--brand);
  fill: none;
}

/* Side-nav image icons */
.side-nav__link .side-nav__icon{
  width: 28px;
  height: 28px;
  display: block;
}

/* If your SVG files use currentColor (see note below),
   they’ll tint with the link color on hover/focus */
.side-nav__link{ color: var(--muted); }
.side-nav__link:hover,
.side-nav__link:focus{ color: var(--brand); }


.side-nav__link:hover, .side-nav__link:focus-visible{
  transform: translateX(2px);
  border-color: color-mix(in oklab, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow);
  outline: none;
}

/* Tooltip from data-label */
.side-nav__link::after{
  content: attr(data-label);
  position: absolute;
  left: calc(100% + .5rem);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .28rem .5rem;
  font-size: .78rem;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  translate: -4px 0;
  pointer-events: none;
  transition: opacity .18s ease, translate .18s ease;
}
.side-nav__link:hover::after,
.side-nav__link:focus-visible::after{
  opacity: 1;
  translate: 0 0;
}

/* Current page highlight */
.side-nav__link.is-current{
  background: color-mix(in oklab, var(--brand) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--brand) 50%, var(--border));
}
.side-nav__link.is-current svg{
  stroke: color-mix(in oklab, var(--brand) 90%, var(--text));
}

/* Respect small screens: hide or dock at top */
@media (max-width: 900px){
  .side-nav{ display: none; } /* simplest: hide on mobile */
}

/* Reduced-motion users */
@media (prefers-reduced-motion: reduce){
  .side-nav__link, .side-nav__link::after{ transition: none; }
}

/* Mask-based icons — use brand color automatically */
.side-nav__link::before{
  content:"";
  width: 28px;
  height: 28px;
  background-color: var(--brand);             /* the tint */
  -webkit-mask: no-repeat center / contain;   /* Safari */
  mask: no-repeat center / contain;           /* Chrome/Firefox */
}

/* Point each icon class to your files */
.icon-projects::before      { -webkit-mask-image: url("images/projects.svg");     mask-image: url("images/projects.svg"); }
.icon-publications::before  { -webkit-mask-image: url("images/books.svg");        mask-image: url("images/books.svg"); }
.icon-about::before         { -webkit-mask-image: url("images/about.svg");     mask-image: url("images/about.svg"); }
.icon-download::before         { -webkit-mask-image: url("images/download.svg");     mask-image: url("images/download.svg"); }

/* Keep your existing rules for hover/focus box, tooltip, current state, etc. */


/* =======================================================================
   Footer
   ======================================================================= */
footer{ text-align:center; padding:2rem 1rem; font-size:.9rem; color:var(--muted); }

/* =======================================================================
   Mobile
   ======================================================================= */
@media (max-width: 640px){
  /* header: show burger, hide nav until toggled */
  .hamburger{ display: inline-block; }
  #siteNav{ display: none; flex-direction: column; gap: .5rem; }
  #siteNav.open{ display: flex; }

  .hero{ grid-template-columns: 1fr; gap: 1.5rem; }
  #projects .projects-grid{ grid-template-columns: 1fr; }
}
