/* --------- CSS RESET (lightweight) --------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }
img { max-width: 100%; display: block; }

/* --------- THEME VARIABLES --------- */
:root {
  /* Light theme (default) */

  --bg: #ffffff;
  --text: #111111;
  --muted: #555555;
  --link: #111111;
  --border: rgba(0, 0, 0, 0.2);



  --maxw: 1100px;
  --padx: 2.5rem;
  --pady: 2.25rem;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* dark mode */
html[data-theme="bw"] {
  --bg: #000000;
  --text: #ffffff;
  --muted: #cccccc;
  --link: #ffffff;
  --border: rgba(255, 255, 255, 0.25);
}


/* --------- BASE --------- */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 4px;
}

a:hover {
  opacity: 0.85;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--padx);
  padding-right: var(--padx);
}

/* --------- NAV --------- */
.site-header {
  padding-top: 1.75rem;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.toggle-track {
  width: 48px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px;
  display: flex;
  align-items: center;
  background: transparent;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(0);
  transition: transform 0.25s ease, background 0.25s ease;
}

.theme-toggle {
    outline: none;
}

html[data-theme="bw"] .toggle-thumb {
  transform: translateX(22px);
}


.theme-toggle:focus-visible .toggle-track {
  box-shadow: 0 0 0 2px var(--text);
}

.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  outline: none;
  box-shadow: none;
  cursor: pointer;
  line-height: 0;
}




/* --------- HERO --------- */
.hero {
  padding-top: 6rem;
  padding-bottom: 4rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3.5rem;
}

.hero__text {
  flex: 1;
  min-width: 320px;
}

.hero__hello {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
}

.hero__title {
  margin: 0 0 1rem 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
}

.hero__subtitle {
  margin: 0 0 2rem 0;
  color: var(--muted);
  max-width: 55ch;
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
  margin-top: 0.5rem;
}

/* Icon links */
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 200ms ease, transform 200ms ease;
}

.icon-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.icon-link svg {
  width: 20px;
  height: 20px;
  display: block;
}

.hero__media {
  width: 280px;
  flex: 0 0 auto;
}

.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;       /* forces a vertical portrait box */
  object-fit: cover;          /* crops nicely */
  border-radius: 18px;
  border: 1px solid var(--border);
}

/* --------- FOOTER --------- */
.site-footer {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.footer__small {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --------- RESPONSIVE --------- */
@media (max-width: 900px) {
  .hero {
    padding-top: 3.5rem;
    flex-direction: column;
    align-items: stretch;
  }

  .hero__media {
    width: min(360px, 100%);
  }

  .nav__right {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}


html, body {
  height: 100%;
  background: var(--bg);
}



/* --------- PAGE --------- */
.page {
  padding-top: 4.5rem;
  padding-bottom: 4rem;
}

.page__header {
  margin-bottom: 2.5rem;
}

.page__title {
  margin: 0 0 0.75rem 0;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  letter-spacing: -0.02em;
}

.page__subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
}

/* --------- PROJECTS GRID --------- */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
}

@media (max-width: 900px) {
  .projects {
    grid-template-columns: 1fr;
  }
}

/* --------- CARD --------- */
.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem 1.25rem;
  background: transparent;
}

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card__title {
  margin: 0;
  font-size: 1.25rem;
}

.card__desc {
  margin: 0 0 1rem 0;
  color: var(--muted);
}

.card__links {
  display: flex;
  gap: 1.25rem;
}

/* --------- TAGS --------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
}

/* =========================
   GALLERY PAGE
========================= */

/* Filters (simple, consistent with your design) */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1.5rem 0;
}

.pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  opacity: 0.8;
}

.pill:hover { opacity: 1; }

.pill.is-active {
  opacity: 1;
  background: var(--text);
  color: var(--bg);
}

/* Grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

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

@media (max-width: 650px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Card */
.gallery-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: transparent;
}

/* Clickable image area */
.gallery-card__btn {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

/* Make all thumbnails consistent:
   - fixed aspect ratio
   - object-fit cover so they crop nicely
*/
.gallery-card img {
  width: 100%;
  aspect-ratio: 4 / 3;   /* change to 1/1 if you prefer squares */
  object-fit: cover;
  display: block;
  transition: transform 160ms ease, opacity 160ms ease;
}

.gallery-card__btn:hover img {
  transform: scale(1.02);
  opacity: 0.96;
}

/* Caption */
.gallery-card__cap {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.gallery-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.gallery-card__meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

/* =========================
   LIGHTBOX (optional)
========================= */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

html[data-theme="bw"] .lightbox__backdrop {
  background: rgba(255,255,255,0.12);
}

.lightbox__panel {
  position: relative;
  width: min(1100px, 92vw);
  margin: 6vh auto 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.lightbox__img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg);
}

.lightbox__close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__close:hover { opacity: 0.85; }


/* =========================
   GALLERY (FLIP CARDS)
========================= */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Outer card */
.flip {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: transparent;
}

/* Clickable inner wrapper */
.flip__inner {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: block;

  /* flip setup */
  position: relative;
  perspective: 1000px;
  line-height: 0;
}

/* preserve sizing + ensure all images fit uniformly */
.flip__face {
  width: 100%;
  aspect-ratio: 4 / 3;    /* change to 1/1 if you want square */
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 220ms ease;
}

/* FRONT */
.flip__front {
  transform: rotateY(0deg);
}

.flip__front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 160ms ease, opacity 160ms ease;
}

/* subtle hover */
.flip__inner:hover .flip__front img {
  transform: scale(1.02);
  opacity: 0.96;
}

/* BACK */
.flip__back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background: var(--bg);
  color: var(--text);

  /* center content */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* caption block on back */
.flip__cap {
  width: 100%;
  max-width: 48ch;
  line-height: 1.45;
}

.flip__title {
  margin: 0 0 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.flip__meta {
  margin: 0 0 0.75rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.flip__desc {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  opacity: 0.95;
}

/* flipped state */
.flip.is-flipped .flip__front { transform: rotateY(180deg); }
.flip.is-flipped .flip__back  { transform: rotateY(360deg); }

/* keyboard focus */
.flip__inner:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--text);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .flip__face { transition: none; }
  .flip__front img { transition: none; }
}


/* =========================
   FLIP GALLERY CARDS
========================= */

/* Grid (if not already defined elsewhere) */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

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

@media (max-width: 650px) {
  .gallery { grid-template-columns: 1fr; }
}

/* Outer card */
.flip {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: transparent;
}

/* Clickable inner wrapper */
.flip__inner {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  position: relative;
  perspective: 1000px;
  display: block;
  line-height: 0;
}

/* Faces (shared) */
.flip__face {
  width: 100%;
  aspect-ratio: 4 / 3;          /* change to 1 / 1 for square */
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 220ms ease;
}

/* FRONT */
.flip__front {
  transform: rotateY(0deg);
}

.flip__front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 160ms ease, opacity 160ms ease;
}

/* Subtle hover */
.flip__inner:hover .flip__front img {
  transform: scale(1.02);
  opacity: 0.96;
}

/* BACK */
.flip__back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background: var(--bg);
  color: var(--text);

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Single clean line */
.flip__line {
  margin: 0;
  max-width: 28ch;
  text-align: center;
  line-height: 1.35;
  font-size: 1rem;
  color: var(--muted);
}

/* Flipped state */
.flip.is-flipped .flip__front {
  transform: rotateY(180deg);
}

.flip.is-flipped .flip__back {
  transform: rotateY(360deg);
}

/* Keyboard accessibility */
.flip__inner:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--text);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .flip__face {
    transition: none;
  }

  .flip__front img {
    transition: none;
  }
}


/* =========================
   ABOUT PAGE TYPOGRAPHY
========================= */

.about__grid {
  display: block;
}

/* Main reading column */
.about__main {
  width: 100%;                     /* use full container width */
  overflow: hidden;                /* contain floated carousel */
}


.about__main p {
  margin: 0 0 1rem 0;
  font-size: 1.02rem;           /* slightly nicer for reading */
  line-height: 1.7;
  color: var(--text);
}

.about__main p:last-child {
  margin-bottom: 0;
}

/* Style inline links in about content */
.about__main p a {
  text-decoration: none;
  font-weight: 600;
  color: var(--muted);
  transition: opacity 200ms ease;
}

.about__main p a:hover {
  opacity: 0.7;
}

/* Dark mode link color adjustment */
html[data-theme="bw"] .about__main p a {
  color: var(--muted);
}

/* Sidebar cards */
.about__side {
  display: grid;
  gap: 1rem;
}

.about__card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.1rem 1.1rem;
}

.about__h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
}

.about__mini {
  margin: 0.25rem 0 0 1.1rem;
  padding: 0;
}

.about__mini li {
  margin: 0.35rem 0;
  color: var(--muted);
}



/* =========================
   ABOUT PHOTO CAROUSEL
========================= */

.about-gallery {
  float: right;
  width: 320px;                 /* controls carousel size */
  margin: 0.25rem 0 1.5rem 2rem; /* space from text */
  shape-outside: margin-box;
}

.carousel {
  display: block;
}

/* Carousel flip card */
.carousel__flip {
  margin: 0 0 0.5rem 0;
}

.carousel__flip .flip__face {
  aspect-ratio: 4 / 5;          /* vertical portrait orientation */
}

.carousel__flip .flip__front img,
.carousel__flip .flip__back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel__flip .flip__back {
  background: var(--bg);
}

.carousel__cap {
  margin: 0 0 0.5rem 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  min-height: 2.5rem;
}

/* Minimal controls */
.carousel__controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.carousel__btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 0.95rem;
  transition: opacity 150ms ease, border-color 150ms ease;
}

.carousel__btn:hover {
  opacity: 0.7;
  border-color: var(--text);
}

.carousel__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--text);
}

/* Mobile: stack carousel above text */
@media (max-width: 800px) {
  .about-gallery {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem 0;
    max-width: 400px;
  }
  
  .carousel__img {
    aspect-ratio: 16 / 10;      /* wider on mobile */
  }
}


/* Clear float after main text */
.about__main::after {
  content: "";
  display: block;
  clear: both;
}

/* =========================
   BLOG (password-protected)
========================= */
.blog-gate {
  max-width: 400px;
}

.blog-auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.blog-auth-form input {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: var(--bg);
  color: var(--text);
}

.blog-auth-form .btn {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.blog-auth-error {
  margin-top: 0.75rem;
  color: #c00;
}

html[data-theme="bw"] .blog-auth-error {
  color: #f66;
}

.blog-list {
  display: grid;
  gap: 1.25rem;
}

.blog-list .card__title a {
  text-decoration: none;
}

.blog-post__body {
  max-width: 70ch;
}

.blog-post__body p {
  margin: 0 0 1rem 0;
  line-height: 1.7;
}

.blog-post__body h2 {
  margin: 2rem 0 0.75rem 0;
  font-size: 1.25rem;
}

.blog-post__body h3 {
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.1rem;
}

.blog-post__body ul {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.blog-post__body li {
  margin: 0.35rem 0;
}

.blog-post__body code {
  font-size: 0.9em;
  padding: 0.15rem 0.4rem;
  background: var(--border);
  border-radius: 4px;
}

/* =========================
   NOTES PAGE: topics + outline
========================= */
.notes-layout {
  display: grid;
  grid-template-columns: minmax(0, 200px) 1fr minmax(0, 220px);
  gap: 2rem;
  align-items: start;
  margin-top: 1.5rem;
}

/* Single topic page: content + outline only (no left sidebar) */
.notes-layout.notes-topic-page {
  grid-template-columns: 1fr minmax(0, 220px);
}

.notes-topics {
  position: sticky;
  top: 2rem;
  border-right: 1px solid var(--border);
  padding-right: 1.25rem;
}

.notes-topics__title {
  margin: 0 0 0.75rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.notes-topics__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes-topics__item {
  margin: 0;
}

.notes-topics__link {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.notes-topics__link:hover {
  background: var(--border);
  color: var(--text);
}

.notes-topics__link.is-active {
  font-weight: 600;
  color: var(--text);
}

.notes-topic {
  display: none;
}

.notes-topic.is-visible {
  display: block;
}

.notes-outline {
  position: sticky;
  top: 2rem;
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}

.notes-outline__title {
  margin: 0 0 0.75rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.notes-outline__nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes-outline__item {
  margin: 0;
}

.notes-outline__link {
  display: block;
  padding: 0.35rem 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1.35;
}

.notes-outline__link:hover {
  color: var(--text);
}

.notes-outline__link.is-active {
  color: var(--text);
  font-weight: 500;
}

.notes-outline__item--h3 .notes-outline__link {
  padding-left: 0.75rem;
  font-size: 0.8rem;
}

/* Notes index: list of topic links */
.notes-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.notes-index__link {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.notes-index__link:hover {
  background: var(--border);
}

.notes-index__link strong {
  font-size: 1.05rem;
}

@media (max-width: 1100px) {
  .notes-layout {
    grid-template-columns: 1fr;
  }

  .notes-topics {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 1rem;
    position: static;
  }

  .notes-outline {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
    position: static;
  }
}
