/* =========================================================
   style.css — Clean & Classy Portfolio
   ========================================================= */

/* ---------------------------------------------------------
   1. Fonts
   --------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ---------------------------------------------------------
   2. CSS Variables & Theme
   --------------------------------------------------------- */

:root {
  --color-bg: #f4efe4;
  --color-bg-alt: #fdfaf3;
  --color-fg: #26231d;
  --color-muted: #6b6357;
  --color-border: rgba(45, 40, 30, 0.1);
  --color-border-hover: rgba(45, 40, 30, 0.22);

  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;

  --transition-fast: 0.15s ease;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root, :root[data-theme="auto"] {
    --color-bg: #171717;
    --color-bg-alt: #1f1f1f;
    --color-fg: #f0eee8;
    --color-muted: #a39a89;
    --color-border: rgba(241, 233, 217, 0.09);
    --color-border-hover: rgba(241, 233, 217, 0.22);
    color-scheme: dark;
  }
}

:root[data-theme="light"] {
  --color-bg: #f4efe4;
  --color-bg-alt: #fdfaf3;
  --color-fg: #26231d;
  --color-muted: #6b6357;
  --color-border: rgba(45, 40, 30, 0.1);
  --color-border-hover: rgba(45, 40, 30, 0.22);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --color-bg: #171717;
  --color-bg-alt: #1f1f1f;
  --color-fg: #f0eee8;
  --color-muted: #a39a89;
  --color-border: rgba(241, 233, 217, 0.09);
  --color-border-hover: rgba(241, 233, 217, 0.22);
  color-scheme: dark;
}

/* ---------------------------------------------------------
   3. Base Reset
   --------------------------------------------------------- */

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

::selection {
  background: var(--color-fg);
  color: var(--color-bg);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-fg);
  background-color: var(--color-bg);
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------------------------------------------------------
   4. Typography
   --------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__title,
.nav__logo,
.projects__header h2,
.photos__header h2,
.about__header h2,
.contact__header h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(3.5rem, 12vw, 8rem);
}

h2 {
  font-size: clamp(2.5rem, 6vw, 4rem);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

p {
  color: var(--color-muted);
  max-width: 60ch;
}

/* ---------------------------------------------------------
   5. Layout
   --------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--space-xl) 0;
}

/* ---------------------------------------------------------
   6. Navigation
   --------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  transition: all var(--transition-base);
}

.nav.scrolled {
  background: rgba(250, 250, 250, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

:root[data-theme="dark"] .nav.scrolled {
  background: rgba(10, 10, 10, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .nav.scrolled {
    background: rgba(10, 10, 10, 0.9);
  }
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.nav__logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  transition: opacity var(--transition-fast);
}

.nav__logo:hover {
  opacity: 0.6;
}

.nav__links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.nav__link {
  position: relative;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-muted);
  transition: color var(--transition-fast);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-fg);
  transition: width var(--transition-base);
}

.nav__link:hover,
.nav__link.active {
  color: var(--color-fg);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

@media (max-width: 640px) {
  .nav__logo {
    display: none;
  }

  .nav__inner {
    justify-content: center;
  }

  .nav__links {
    gap: var(--space-md);
  }

  .nav__link {
    font-size: 0.875rem;
  }
}

/* ---------------------------------------------------------
   7. Hero Section
   --------------------------------------------------------- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  border-top: none !important;
}

.hero__image {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: var(--space-md);
  transition: transform var(--transition-base);
}

.hero__image:hover {
  transform: scale(1.02);
}

.hero__title {
  margin-bottom: 0.5rem;
  cursor: default;
  text-align: center;
  line-height: 1;
}

.hero__name-first,
.hero__name-last {
  display: block;
}

/* Name is a link on sub-pages (not home) — glow on hover */
.hero__title a {
  cursor: pointer;
  transition: text-shadow var(--transition-base);
}

.hero__title a:hover {
  text-shadow: 0 0 6px currentColor, 0 0 16px currentColor, 0 0 32px currentColor;
}

.hero__subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
}

.hero__socials {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.hero__socials .hero__nav-link {
  font-size: 0.75rem;
  opacity: 0.65;
}

.hero__socials .hero__nav-link:hover {
  opacity: 1;
}

@media (min-width: 769px) {
  .hero__socials {
    justify-content: flex-start;
  }
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  transition: all var(--transition-base);
}

.social-link:hover {
  color: var(--color-fg);
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
}

.social-link svg {
  width: 17px;
  height: 17px;
}

/* ---------------------------------------------------------
   8. Projects Section
   --------------------------------------------------------- */

.projects {
  background: var(--color-bg);
}

.projects__header,
.photos__header,
.about__header,
.contact__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.projects__header h2,
.photos__header h2,
.about__header h2,
.contact__header h2 {
  margin: 0;
}

.label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.projects__list {
  max-width: 720px;
  margin: 0 auto;
}

.project-item {
  display: block;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.project-item:first-child {
  border-top: 1px solid var(--color-border);
}

.project-item__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.project-item__title {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

.project-item__role {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.project-item__description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin: 0;
  max-width: none;
}

.project-item__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  margin-top: 0.75rem;
  transition: color var(--transition-fast), text-shadow var(--transition-base);
}

.project-item__link:hover {
  color: var(--color-fg);
  text-shadow: 0 0 6px currentColor, 0 0 16px currentColor, 0 0 32px currentColor;
}

.project-item__link svg {
  width: 12px;
  height: 12px;
  transition: transform var(--transition-fast);
}

.project-item__link:hover svg {
  transform: translateX(2px);
}

@media (max-width: 640px) {
  .project-item__header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* ---------------------------------------------------------
   9. Photos Section
   --------------------------------------------------------- */

.photos__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 0;
  /* Sit above the fixed grain canvas (z-index 9997) so the static
     texture doesn't overlay the photographs. */
  position: relative;
  z-index: 9998;
}

.photo-item {
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  will-change: transform;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photos__links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.photos__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.photos__link-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* ---------------------------------------------------------
   10. About Section
   --------------------------------------------------------- */

.about {
  background: var(--color-bg);
}

.about__content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.about__text p {
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 1.5rem;
  text-align: left;
}

.about__text p:first-child {
  font-size: 1.2rem;
  color: var(--color-fg);
  font-weight: 400;
}

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

/* ---------------------------------------------------------
   11. Contact Section
   --------------------------------------------------------- */

.contact__inner {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.contact__header {
  margin-bottom: var(--space-sm);
}

.contact__text {
  margin-bottom: var(--space-md);
  margin-left: auto;
  margin-right: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--color-fg);
  border-radius: 100px;
  color: var(--color-fg);
  background: transparent;
  transition: all var(--transition-base);
}

.btn:hover {
  background: var(--color-fg);
  color: var(--color-bg);
  transform: translateY(-2px);
}

.btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn:hover svg {
  transform: translateX(4px);
}

/* ---------------------------------------------------------
   12. Featured Section
   --------------------------------------------------------- */

.featured {
  min-height: auto;
  flex-direction: column;
  align-items: stretch;
  padding: var(--space-lg) 0;
  background: var(--color-bg);
}

.featured__label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: center;
  display: block;
  width: 100%;
  margin-bottom: var(--space-md);
}

.featured__scroller {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
}

.featured__track {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: max-content;
  animation: scroll-logos var(--logo-duration, 30s) linear infinite;
}


@keyframes scroll-logos {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-1 * var(--logo-distance, 50%))); }
}

.featured__logo {
  flex-shrink: 0;
  height: 28px;
  width: auto;
  opacity: 0.4;
  transition: opacity var(--transition-base);
}

:root[data-theme="light"] .featured__logo {
  filter: invert(1) grayscale(100%);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] .featured__logo {
    filter: invert(1) grayscale(100%);
  }
}

:root[data-theme="dark"] .featured__logo {
  filter: grayscale(100%);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .featured__logo {
    filter: grayscale(100%);
  }
}

.featured__logo:hover {
  opacity: 0.8;
}

/* ---------------------------------------------------------
   13. Footer
   --------------------------------------------------------- */

.footer {
  padding: var(--space-md) 0;
  text-align: center;
  background: var(--color-bg);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer__copy {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.theme-toggle {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  color: var(--color-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  text-align: center;
}

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

/* ---------------------------------------------------------
   14. Responsive Adjustments
   --------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --space-xl: 4rem;
    --space-lg: 3rem;
    --space-md: 1.5rem;
  }

  .page-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    position: relative;
  }

  .page-header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
  }

  .page-header__nav.open {
    display: flex;
  }

  .page-header__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
  }

  .page-header__hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-fg);
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
  }

  .page-header__hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .page-header__hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .page-header__hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .hero__image {
    width: 130px;
    height: 130px;
  }

  h1 {
    font-size: clamp(2.5rem, 15vw, 4rem);
  }

  h2 {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .container {
    padding: 0 var(--space-sm);
  }

  .about__text p {
    font-size: 1rem;
  }

  .about__text p:first-child {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  :root {
    --space-xl: 3rem;
    --space-lg: 2rem;
    --space-md: 1rem;
  }

  .hero {
    min-height: auto;
    padding-bottom: var(--space-lg);
  }

  .hero__nav {
    gap: var(--space-sm);
  }

  .hero__image {
    width: 110px;
    height: 110px;
  }

  h1 {
    font-size: clamp(2rem, 14vw, 3rem);
  }

  h2 {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
  }

  .hero__subtitle {
    font-size: 0.85rem;
  }

  .hero__socials {
    gap: var(--space-sm);
  }

  .social-link {
    width: 36px;
    height: 36px;
  }

  .social-link svg {
    width: 15px;
    height: 15px;
  }

  .project-item {
    padding: 1.25rem 0;
  }

  .project-item__title {
    font-size: 1rem;
  }

  .project-item__description {
    font-size: 0.85rem;
  }

  .photos__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .photos__links {
    gap: var(--space-md);
  }

  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.85rem;
  }

  .featured__track {
    gap: 2rem;
  }

  .featured__logo {
    height: 22px;
  }

  .footer__inner {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* ---------------------------------------------------------
   15. Reduced Motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------------------------------------------------------
   16. Home Page Two-Column Layout
   --------------------------------------------------------- */

/* Desktop: side-by-side */
@media (min-width: 769px) {
  section.home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-xl) var(--space-lg);
    min-height: 100vh;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .home__left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .home__left .hero__title {
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    text-align: left;
  }

  .home__left .hero__nav {
    justify-content: flex-start;
  }

  .home__right .about__text p {
    text-align: left;
    max-width: none;
  }
}

/* Mobile: stacked */
@media (max-width: 768px) {
  section.home {
    display: flex;
    flex-direction: column;
    min-height: auto;
    padding: 0;
    align-items: stretch;
  }

  .home__left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-xl) var(--space-sm) var(--space-md);
  }

  .home__right {
    padding: var(--space-xl) var(--space-sm) var(--space-xl);
  }

  .home__right .page-title {
    text-align: center;
  }

  .home__left .hero__nav {
    flex-wrap: nowrap;
    gap: var(--space-xs);
  }

  .home__left .hero__nav-link {
    font-size: 0.8rem;
    white-space: nowrap;
  }
}

/* ---------------------------------------------------------
   17. Hero Nav (links below name)
   --------------------------------------------------------- */

.hero__nav {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: nowrap;
  justify-content: center;
  margin-top: var(--space-md);
}

.hero__nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-muted);
  transition: color var(--transition-fast), text-shadow var(--transition-base);
}

.hero__nav-link:hover {
  color: var(--color-fg);
  text-shadow: 0 0 6px currentColor, 0 0 16px currentColor, 0 0 32px currentColor;
}

.hero__nav-link.active {
  color: var(--color-fg);
}

/* ---------------------------------------------------------
   Sub-page content (shared two-column layout)
   --------------------------------------------------------- */

@media (min-width: 769px) {
  .home__left--sticky {
    position: sticky;
    top: var(--space-xl);
    align-self: flex-start;
  }

  /* Stays vertically centered in the viewport through the whole scroll */
  .home__left--centered {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    justify-content: center;
  }

  /* Zero the section's vertical padding so the sticky column centers exactly;
     move that breathing room onto the content column instead. */
  section.home:has(.home__left--centered) {
    padding-top: 0;
    padding-bottom: 0;
  }

  section.home:has(.home__left--centered) .home__right {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
}

.page-title {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.03em;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.1;
  margin-bottom: var(--space-md);
  color: var(--color-fg);
}

.home__right .projects__list {
  max-width: none;
  margin: 0;
}

.home__right .photos__grid {
  grid-template-columns: repeat(4, 1fr);
  max-width: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 769px) {
  .home__right .photos__links {
    justify-content: flex-start;
  }
}

/* Home page: copyright + sun/moon toggle sit inline at the right of the socials */
.home__controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.home__copy {
  font-size: 14px;
  line-height: 1;
  color: var(--color-muted);
  opacity: 0.65;
}

.theme-icon {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-muted);
  opacity: 0.65;
  display: inline-flex;
  align-items: center;
  transition: color var(--transition-fast), opacity var(--transition-fast), filter var(--transition-base);
}

.theme-icon:hover {
  color: var(--color-fg);
  opacity: 1;
  filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 0 16px currentColor);
}

.theme-icon svg {
  width: 14px;
  height: 14px;
}

.theme-icon .icon-sun,
.theme-icon .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-icon .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon .icon-moon {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] .theme-icon .icon-sun {
    display: block;
  }
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-icon .icon-moon {
    display: block;
  }
}

/* Home page: Featured scroller + copyright/theme live in their own block
   (bottom of the left column on desktop, below everything on mobile) */

/* Prevent the wide marquee from blowing out the grid column */
.home__left,
.home__right,
.home__extras {
  min-width: 0;
}

.home__extras .featured {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
}

.home__extras .featured__scroller {
  width: 100%;
}

.home__extras .footer {
  width: 100%;
  padding: 0;
  margin-top: var(--space-md);
  background: transparent;
}

/* Desktop home page: name/nav top-left, bio right, extras pinned bottom-left */
@media (min-width: 769px) {
  section#home {
    align-items: stretch;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "left  right"
      "extras right";
  }

  #home .home__left {
    grid-area: left;
    justify-content: center;
  }

  #home .home__right {
    grid-area: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  #home .home__extras {
    grid-area: extras;
    align-self: end;
  }

  .home__extras .featured {
    margin-top: var(--space-md);
  }

  .home__extras .featured__label {
    text-align: left;
    margin-bottom: var(--space-sm);
  }

  .home__extras .footer {
    text-align: left;
  }

  .home__extras .footer__inner {
    justify-content: flex-start;
  }
}

/* Mobile home page: extras sits below all content, centered */
@media (max-width: 768px) {
  .home__extras {
    padding: 0 var(--space-sm) var(--space-xl);
  }

  .home__extras .featured {
    margin-top: 0;
  }
}

/* ---------------------------------------------------------
   17. Page Header (for sub-pages)
   --------------------------------------------------------- */

.page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
}

.page-header__name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--color-fg);
  transition: text-shadow var(--transition-base);
}

.page-header__name:hover {
  text-shadow: 0 0 6px currentColor, 0 0 16px currentColor, 0 0 32px currentColor;
}

.page-header__nav {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.page-header__nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-muted);
  transition: color var(--transition-fast), text-shadow var(--transition-base);
}

.page-header__nav-link:hover,
.page-header__nav-link.active {
  color: var(--color-fg);
}

.page-header__nav-link:hover {
  text-shadow: 0 0 6px currentColor, 0 0 16px currentColor, 0 0 32px currentColor;
}

.page-header__hamburger {
  display: none;
}

@media (max-width: 768px) {
  .page-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    position: relative;
  }
  .page-header__nav {
    display: none;
  }
  .page-header__nav.open {
    display: flex;
  }
  .page-header__hamburger {
    display: flex;
  }
}

/* ---------------------------------------------------------
   18. View Transitions
   --------------------------------------------------------- */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
}
