@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Sora:wght@400;500;600&display=swap");

:root {
  --bg: #f7f5ef;
  --surface: rgba(255, 255, 255, 0.72);
  --ink: #1d1f27;
  --muted: #4a4f63;
  --line: rgba(29, 31, 39, 0.14);
  --accent: #0a7e78;
  --accent-dark: #066a65;
  --button-bg: #082a45;
  --button-bg-hover: #061f34;
  --button-text: #ffffff;
  --radius: 1rem;
  --shadow: 0 18px 40px rgba(16, 25, 36, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sora", sans-serif;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, #ffd8b8 0%, transparent 42%),
    radial-gradient(circle at 85% 30%, #c8f2e4 0%, transparent 36%),
    var(--bg);
}

main,
.site-header,
.site-footer {
  width: min(68rem, 92vw);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 4;
  isolation: isolate;
}

/* Full width sticky blur backdrop behind constrained header content. */
.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(247, 245, 239, 0.55);
  border-bottom: 1px solid var(--line);
  z-index: -1;
  pointer-events: none;
}

.logo {
  width: 2.3rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

nav a:hover {
  border-color: var(--ink);
}

nav a.active {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
}

.section {
  padding: 4.5rem 0;
  animation: rise 700ms ease both;
}

.section-lead {
  max-width: 70ch;
  color: var(--muted);
}

.page-main {
  min-height: 70vh;
}

.hero {
  padding-top: 6rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  line-height: 1.18;
  margin: 0 0 0.8rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  max-width: 14ch;
}

h1 span {
  color: var(--accent-dark);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.hero-copy {
  max-width: 60ch;
  color: var(--muted);
}

.hero-meta {
  margin-top: 0.2rem;
  color: var(--ink);
  font-weight: 500;
}

.button {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.72rem 1.1rem;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid rgba(7, 38, 63, 0.22);
  text-decoration: none;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: background-color 200ms ease;
}

.button:hover {
  background: var(--button-bg-hover);
}

.button-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  text-shadow: none;
}

.button-ghost:hover {
  background: rgba(255, 255, 255, 0.5);
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.projects-grid {
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card p,
.section p {
  color: var(--muted);
}

.card ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.card h4 {
  margin: 0.9rem 0 0.4rem;
  font-size: 0.95rem;
  font-family: "Sora", sans-serif;
}

/* Project cards stay compact and open inside a separate zoom modal. */
.project-card {
  position: relative;
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(8, 42, 69, 0.3);
}

.project-summary {
  margin-bottom: 0.7rem;
}

.project-open {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.85rem;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    transform 220ms ease;
}

.project-open:hover {
  background: #ffffff;
  border-color: var(--accent-dark);
}

.project-open:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.project-open::before {
  content: "+";
  display: inline-block;
  margin-right: 0.45rem;
  font-weight: 700;
}

.project-details[hidden] {
  display: none;
}

.project-stack {
  margin-top: 0.7rem;
}

.project-media-grid {
  margin: 0.8rem 0 0.4rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.project-media-grid-single {
  grid-template-columns: 1fr;
}

.project-media {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.85);
  cursor: zoom-in;
  transition: border-color 180ms ease;
}

.project-media:hover {
  border-color: rgba(8, 42, 69, 0.32);
}

.project-media:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.project-media img {
  display: block;
  width: 100%;
  height: auto;
}

.project-media figcaption {
  padding: 0.45rem 0.6rem 0.6rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

body.modal-open {
  overflow: hidden;
}

/* Zoom modal that animates from the clicked project card bounds. */
.project-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 1rem;
  pointer-events: none;
}

.project-overlay[hidden] {
  display: none;
}

.project-overlay.is-visible {
  pointer-events: auto;
}

.project-overlay-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(9, 17, 26, 0.45);
  opacity: 0;
  transition: opacity 240ms ease;
  cursor: pointer;
}

.project-overlay.is-visible .project-overlay-backdrop {
  opacity: 1;
}

.project-modal {
  position: relative;
  width: min(54rem, 94vw);
  max-height: 86vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 66px rgba(10, 17, 28, 0.24);
  transform-origin: top left;
  transition:
    transform 360ms cubic-bezier(0.2, 0.78, 0.18, 1),
    opacity 240ms ease;
  opacity: 0;
}

.project-overlay.is-visible .project-modal {
  opacity: 1;
}

.project-modal-close {
  position: sticky;
  top: 0;
  float: right;
  margin: -0.2rem -0.2rem 0.7rem 0;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #ffffff;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.project-modal-close:hover {
  border-color: var(--accent-dark);
}

.project-modal-details {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.project-overlay.show-details .project-modal-details {
  opacity: 1;
  transform: translateY(0);
}

.project-image-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 1rem;
  pointer-events: none;
}

.project-image-overlay[hidden] {
  display: none;
}

.project-image-overlay.is-visible {
  pointer-events: auto;
}

.project-image-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(9, 17, 26, 0.66);
  opacity: 0;
  transition: opacity 200ms ease;
  cursor: pointer;
}

.project-image-overlay.is-visible .project-image-backdrop {
  opacity: 1;
}

.project-image-modal {
  position: relative;
  width: min(74rem, 96vw);
  max-height: 90vh;
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 34px 75px rgba(10, 17, 28, 0.3);
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

.project-image-overlay.is-visible .project-image-modal {
  opacity: 1;
  transform: scale(1);
}

.project-image-modal img {
  display: block;
  width: 100%;
  max-height: calc(90vh - 5.2rem);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #ffffff;
}

.project-image-modal figcaption {
  color: var(--muted);
  font-size: 0.88rem;
}

.project-image-close {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #ffffff;
  padding: 0.32rem 0.62rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.project-image-close:hover {
  border-color: var(--accent-dark);
}

.project-image-close:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.skill-keywords {
  margin-top: 0.5rem;
  color: var(--muted);
}

.section a:not(.button) {
  color: var(--accent-dark);
}

.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.theme-toggle,
.a11y-toggle {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.theme-toggle:hover,
.a11y-toggle:hover {
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

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

.theme-toggle span,
.a11y-toggle span {
  font-size: 1rem;
  line-height: 1;
}

.theme-menu-wrap,
.a11y-menu-wrap {
  position: relative;
  display: inline-flex;
}

.theme-menu,
.a11y-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  bottom: auto;
  min-width: 11rem;
  padding: 0.32rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.2rem;
  z-index: 25;
}

.theme-menu[hidden],
.a11y-menu[hidden] {
  display: none;
}

.theme-option,
.a11y-option {
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.theme-option:hover,
.a11y-option:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.22);
}

.theme-option:focus-visible,
.a11y-option:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.theme-option[aria-checked="true"],
.a11y-option[aria-checked="true"] {
  border-color: var(--accent-dark);
  font-weight: 600;
}

.theme-option-dot,
.a11y-option-dot {
  font-size: 0.72rem;
  line-height: 1;
  width: 0.8rem;
  text-align: center;
}

.compact-section {
  padding-top: 2.5rem;
}

.bg-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.36;
  z-index: -1;
}

.bg-shape-1 {
  width: 320px;
  height: 320px;
  background: #f5b28a;
  left: -80px;
  top: 16vh;
}

.bg-shape-2 {
  width: 360px;
  height: 360px;
  background: #7ecab7;
  right: -110px;
  top: 55vh;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .site-header {
    padding-top: 0.75rem;
    gap: 0.7rem;
  }

  nav {
    gap: 0.7rem;
    font-size: 0.95rem;
    justify-content: flex-start;
  }

  .section {
    padding: 3.2rem 0;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 3.8rem;
  }

  .hero-actions {
    width: 100%;
  }
}

/* Accessibility helpers */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 60;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0.75rem;
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

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

html.a11y-large-text {
  font-size: 112%;
}

html.a11y-underline-links a:not(.button):not(.logo) {
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}

html.a11y-reduce-motion {
  scroll-behavior: auto;
}

html.a11y-high-contrast {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #000000;
  --muted: #000000;
  --line: #000000;
  --accent: #000000;
  --accent-dark: #000000;
  --button-bg: #000000;
  --button-bg-hover: #121212;
  --button-text: #ffffff;
  --shadow: none;
}

html.a11y-high-contrast body {
  background: #ffffff;
}

html.a11y-high-contrast .bg-shape {
  display: none;
}

html.a11y-high-contrast .card,
html.a11y-high-contrast .project-modal,
html.a11y-high-contrast .project-image-modal,
html.a11y-high-contrast .theme-menu,
html.a11y-high-contrast .a11y-menu {
  border-width: 2px;
  box-shadow: none;
}

html.a11y-high-contrast a,
html.a11y-high-contrast button {
  font-weight: 700;
}

html.a11y-high-contrast a:not(.button):not(.logo) {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.footer-row {
  justify-content: flex-start;
}

.footer-row .theme-menu-wrap {
  margin-left: auto;
}

.footer-row .a11y-menu-wrap {
  margin-left: 0.42rem;
}

/* Header control layout */
.site-header nav {
  margin-left: auto;
}

.header-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  margin-left: 1rem;
}

@media (max-width: 700px) {
  .site-header {
    flex-wrap: wrap;
  }

  .site-header nav {
    order: 2;
    width: 100%;
  }

  .header-controls {
    order: 1;
    margin-left: auto;
  }
}
