/**
 * Global reset-ish, typography, header, footer, a11y helpers.
 */

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

*,
*::before,
*::after {
  cursor: none !important;
}

#cursor-dot,
#cursor-ring {
  mix-blend-mode: normal;
  pointer-events: none;
}

#cursor-dot {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  transition: width 0.15s ease, height 0.15s ease;
  top: -20px;
  left: -20px;
}

#cursor-ring {
  position: fixed;
  width: 0;
  height: 0;
  background: var(--accent);
  border-radius: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.15s ease, height 0.15s ease, opacity 0.15s ease;
  top: -20px;
  left: -20px;
}

body.cursor-hover #cursor-dot {
  width: 14px;
  height: 14px;
}

body.cursor-hover #cursor-ring {
  width: 32px;
  height: 32px;
  opacity: 0.2;
}

:root {
  --content-max: 820px;
  --content-pad-x: 24px;
  --section-gap: 2.75rem;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  position: relative;
  isolation: isolate;
  transition: color 0.3s ease;
  animation: pageFadeIn 0.4s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

main * {
  transition:
    color 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.site-header,
.site-footer {
  transition:
    color 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
}

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

  html,
  body,
  main *,
  .site-header,
  .site-footer,
  .work-row__link,
  .theme-toggle,
  .logo {
    transition-duration: 0.01ms !important;
  }

  .site-nav a::after {
    transition-duration: 0.01ms !important;
  }
}

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

img:not([class*="icon"]):not([class*="logo"]),
.book-glass,
.work-row__thumb,
.photo-strip__item {
  border-radius: 12px;
}

main,
.site-header,
.site-footer {
  position: relative;
  z-index: 2;
}

.work-row__thumb {
  position: relative;
  z-index: 2;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  z-index: 1000;
  border-radius: 4px;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* --- Header --- */
.site-header {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem var(--content-pad-x) 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.site-header__end {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 0.85rem;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.site-nav a {
  position: relative;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  width: 100%;
}

.site-nav a.active {
  color: var(--accent);
  position: relative;
}

.site-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color 0.3s ease,
    background-color 0.3s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  background-color: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle__icon {
  display: block;
}

html[data-scheme="light"] .theme-toggle__icon--sun {
  display: none;
}

html[data-scheme="dark"] .theme-toggle__icon--moon {
  display: none;
}

/* --- Footer --- */
.site-footer {
  margin-top: 6rem;
  padding: var(--section-gap) 0 3rem;
  border-top: 1px solid var(--border);
  background: transparent;
}

.site-footer__inner {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
  text-align: left;
}

.site-footer__inner p {
  margin: 0 0 0.85rem;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-muted);
}

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

.site-footer__greeting {
  color: var(--text);
}

.site-footer__inner a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition:
    color 0.15s ease,
    text-decoration-style 0.15s ease;
}

.site-footer__inner a:hover {
  color: var(--accent);
  text-decoration-style: solid;
}

.site-footer__pipe {
  color: var(--text-muted);
  margin: 0 0.35rem;
  user-select: none;
}

.site-footer__inner p.site-footer__quick {
  margin-bottom: 1rem;
}

.site-footer__signoff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0;
  flex-wrap: wrap;
}

.site-footer__signoff-row .site-footer__signoff {
  margin: 0;
}

.sun-arc-wrap {
  margin: 0;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sun-arc {
  width: 40px;
  height: 24px;
  display: block;
}

.sun-arc-hint {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-top: 0.15rem;
  line-height: 1;
  text-align: right;
}

.sun-arc-wrap:hover .sun-arc-hint,
.sun-arc-wrap:focus-within .sun-arc-hint {
  opacity: 1;
}

.sun-dot {
  transition: cx 1s ease, cy 1s ease, opacity 0.5s ease;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.scroll-track {
  position: fixed;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 120px;
  background: var(--border);
  border-radius: 2px;
  z-index: 9990;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scroll-track.visible {
  opacity: 1;
}

.scroll-track__fill {
  width: 100%;
  height: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s ease;
}

@media (max-width: 768px) {
  .scroll-track {
    display: none;
  }
}

@keyframes leaf-fall {
  0% {
    transform: translateY(0) rotate(-10deg) translateX(0px);
    opacity: 0;
  }
  8% {
    opacity: 0.8;
  }
  30% {
    transform: translateY(28vh) rotate(15deg) translateX(-12px);
  }
  55% {
    transform: translateY(55vh) rotate(-8deg) translateX(8px);
  }
  78% {
    transform: translateY(78vh) rotate(20deg) translateX(-6px);
  }
  92% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(103vh) rotate(10deg) translateX(4px);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .site-nav {
    font-size: 11px;
    gap: 0.55rem;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .site-nav {
    display: none;
  }
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: auto;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9990;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  filter: brightness(1.1);
}
