/* =========================
   Theme variables
   ========================= */

:root {
  --bar-h: 200px;

  --bg: #EEF1F4;
  --bar-bg: #E1E7EE;
  --ink: #14213D;
  --muted: #4B5A73;
  --line: #B9C4D3;
  --accent: #0F766E;

  /* Tint over the banner image so text stays readable (lower the last number to show more image) */
  --banner-tint: rgba(238, 241, 244, 0.75);

  /* Project accent colors */
  --canopy: #0B6E6E;
  --mouse: #8A6A0B;
  --switch: #2A4F9A;

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-heading: "DM Serif Display", Georgia, serif;

  /* Portfolio header blocks */
  --head-bg: #2F5081;   /* calm steel blue */
  --head-fg: #F4F7FA;
  --head-bar: #7DD3C0;  /* accent stripe on the left edge */
}

:root[data-theme="dark"] {
  --bg: #0F1722;
  --bar-bg: #162132;
  --ink: #E6EDF5;
  --muted: #9AA9BF;
  --line: #2C3B52;
  --accent: #7DD3C0;
  --banner-tint: rgba(15, 23, 34, 0.70);

  --canopy: #5FD3D3;
  --mouse: #E3C25A;
  --switch: #8DB4F0;

  --head-bg: #245A6B;   /* muted deep teal, soft against the dark page */
  --head-fg: #E6EDF5;
}


/* =========================
   Global
   ========================= */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
}

a { color: inherit; }

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


/* =========================
   Sticky top bar
   ========================= */

.site-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  width: 100%;
  height: var(--bar-h);
  padding: 0 clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background-color: var(--bar-bg); /* shows if the image is missing */
  background-image:
    linear-gradient(var(--banner-tint), var(--banner-tint)),
    url("assets/sticky_tab_banner.jpg");
  background-size: cover;
  background-position: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-decoration: none;
}

.brand-photo {
  display: block;
  width: 120px;
  height: 120px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font: 700 2.25rem/1.1 var(--font-display); }
.brand-sub  { color: var(--muted); font-size: 0.95rem; }


/* Navigation */

.bar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1.5rem;
}

.bar-nav > a {
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  text-decoration: none;
}

.bar-nav > a:hover { border-bottom-color: var(--accent); }


/* Contents dropdown */

.toc { position: relative; }

.toc summary {
  padding: 0.25rem 0;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: " \25BE"; }
.toc[open] summary::after { content: " \25B4"; }

.toc-list {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 0;
  min-width: 12rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  background: var(--bar-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.toc-list a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
}

.toc-list a:hover { background: var(--bg); color: var(--accent); }


/* Theme toggle */

.theme-toggle {
  padding: 0.4rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 0.95rem var(--font-body);
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }


/* =========================
   Page layout
   ========================= */

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

main section { margin-bottom: 3rem; }

main h2 { font: 700 2rem/1.2 var(--font-display); }

/* Portfolio section headers: cool-colored block with a chamfered corner */
#top h2 {
  --cut: 14px;                       /* size of the angled corner */
  display: inline-block;
  margin: 0;
  padding: 0.5rem 2.5rem 0.55rem 1.25rem;
  border-left: 8px solid var(--head-bar);
  background: var(--head-bg);        /* colors are set per theme at the top of this file */
  color: var(--head-fg);
  font: 400 2rem/1.2 var(--font-heading);
  letter-spacing: 0.01em;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
}


/* =========================
   Cards (shared by every section)
   ========================= */

.card {
  --c: var(--accent);
  position: relative;
  margin: 2.5rem 0 3.5rem;
  padding: 2rem;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--c) 10%, var(--bg)),
    var(--bg) 70%
  );
}

.card h3 { margin: 0; font: 700 1.65rem/1.2 var(--font-display); }
.card p  { margin: 0.75rem 0 0; }

.card h4 {
  margin: 1.25rem 0 0.25rem;
  color: var(--c);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card h4 + p { margin-top: 0.25rem; }

.card ol,
.card ul { margin: 0.25rem 0; padding-left: 1.25rem; }

.item-sub,
.item-meta,
.project-meta { margin-top: 0.3rem; color: var(--muted); font-size: 0.9rem; }

.dl {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--c);
  color: var(--bg);
  font-weight: 500;
  text-decoration: none;
}

.dl:hover { filter: brightness(1.1); }

.dl-note { color: var(--muted); font-size: 0.85rem; }

/* Design doc link (sits above the download button) */
.doc-link {
  display: block;
  width: fit-content;
  margin-top: 1.25rem;
  color: var(--c);
  font-weight: 500;
}

.doc-link + .dl { margin-top: 0.75rem; }


/* Card variants */

.card--about {
  border: 1px solid var(--line);
  border-right: 4px solid var(--c);
  border-radius: 6px 28px 28px 6px;
}

.card--about p { margin: 0; font-size: 1.05rem; }
.card--about p + p { margin-top: 2rem; }

.card--experience {
  border: 1px solid var(--line);
  border-left: 4px solid var(--c);
}

.card--publication {
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: 6px 36px 6px 36px;
}

.item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}

.item-header p { margin: 0; }


/* =========================
   Projects
   ========================= */

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.card--canopy {
  --c: var(--canopy);
  border: 3px solid var(--c);
  border-radius: 36px 6px 36px 6px;
}

.card--mouse {
  --c: var(--mouse);
  border: 3px solid var(--ink);
  border-radius: 48px;
  box-shadow: 10px 10px 0 var(--c);
}

.card--switch {
  --c: var(--switch);
  border: 2px dashed var(--c);
  background-color: color-mix(in srgb, var(--c) 8%, var(--bg));
  background-image:
    linear-gradient(color-mix(in srgb, var(--c) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--c) 14%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
}

.card--switch .project-text {
  padding: 1rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
}

/* Blueprint corner marks */
.card--switch::before,
.card--switch::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 4px solid var(--c);
}

.card--switch::before { top: -4px;    left: -4px;  border-right: 0; border-bottom: 0; }
.card--switch::after  { bottom: -4px; right: -4px; border-left: 0;  border-top: 0; }


/* =========================
   Photo albums
   ========================= */

.album {
  border: 1px solid var(--line);
  background: var(--bg);
}

.album-viewport { position: relative; }

.album-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.album-track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  margin: 0;
  aspect-ratio: 4 / 3;
  background: #E4E6E8;
  scroll-snap-align: center;
}

.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.album-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.album-btn:hover { border-color: var(--c); color: var(--c); }
.prev { left: 0.5rem; }
.next { right: 0.5rem; }

.album-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}


/* =========================
   Footer
   ========================= */

.site-footer { text-align: center; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  padding: 3rem 1.5rem;
}

.footer-links a {
  display: block;
  width: 4rem;
  height: 4rem;
  color: var(--ink);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--accent); }

.footer-links svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.footer-links .cut { fill: var(--bg); }
.footer-links .cut-stroke {
  fill: none;
  stroke: var(--bg);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-footer hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.footer-legal {
  margin: 0;
  padding: 2rem 1.5rem 2.5rem;
}

.views { margin-left: 1rem; color: var(--muted); font-size: 0.9rem; }


/* =========================
   Responsive
   ========================= */

@media (max-width: 860px) {
  .project-grid { grid-template-columns: 1fr; }
  .card { padding: 1.25rem; }
  .card--mouse { border-radius: 32px; }
}

@media (max-width: 760px) {
  :root { --bar-h: 150px; }

  .site-bar {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.75rem;
  }

  .brand-photo { width: 56px; height: 56px; border-width: 2px; }
  .brand-name  { font-size: 1.5rem; }
  .brand-sub   { display: none; }
  .bar-nav     { justify-content: flex-start; gap: 0.4rem 1rem; }

  .footer-links a { width: 3rem; height: 3rem; }
}

@media (max-width: 650px) {
  .item-header { flex-direction: column; gap: 0.25rem; }
  #top h2 { --cut: 10px; padding: 0.4rem 1.75rem 0.45rem 1rem; font-size: 1.6rem; }
}


/* =========================
   Reduced motion
   ========================= */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
