:root {
  color-scheme: light dark;
  --bg: #f4f3ef;
  --bg-soft: #ebeae5;
  --surface: #faf9f5;
  --ink: #20211e;
  --muted: #686a63;
  --line: #cccec5;
  --accent: #e3b829;
  --accent-ink: #24200d;
  --focus: #8a6810;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(63, 58, 38, 0.14);
  --max: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171816;
    --bg-soft: #20211e;
    --surface: #252622;
    --ink: #f0efe8;
    --muted: #b3b5ac;
    --line: #40423c;
    --accent: #e6bd32;
    --accent-ink: #1c1a0e;
    --focus: #f0cf5f;
    --shadow: 0 24px 70px rgba(2, 3, 2, 0.38);
  }
}

:root[data-theme="light"] {
  --bg: #f4f3ef;
  --bg-soft: #ebeae5;
  --surface: #faf9f5;
  --ink: #20211e;
  --muted: #686a63;
  --line: #cccec5;
  --accent: #e3b829;
  --accent-ink: #24200d;
  --focus: #8a6810;
  --shadow: 0 24px 70px rgba(63, 58, 38, 0.14);
}

:root[data-theme="dark"] {
  --bg: #171816;
  --bg-soft: #20211e;
  --surface: #252622;
  --ink: #f0efe8;
  --muted: #b3b5ac;
  --line: #40423c;
  --accent: #e6bd32;
  --accent-ink: #1c1a0e;
  --focus: #f0cf5f;
  --shadow: 0 24px 70px rgba(2, 3, 2, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background-color 240ms ease, color 240ms ease;
}

body.dialog-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

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

button {
  font: inherit;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(calc(100% - 48px), var(--max));
  height: 72px;
  margin-inline: auto;
}

.wordmark {
  justify-self: start;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a,
.site-footer a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 180ms ease;
}

.nav-links a:hover,
.site-footer a:hover {
  color: var(--ink);
}

.theme-toggle {
  justify-self: end;
  min-width: 60px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--surface);
}

.theme-toggle:active,
.button:active,
.project-card:active,
.dialog-close:active {
  transform: translateY(1px);
}

.hero {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  place-items: center;
  min-height: 100dvh;
  padding: 82px 24px 36px;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  width: clamp(280px, 58vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  filter: blur(2px);
}

.hero-mark {
  position: relative;
  z-index: 1;
  align-self: center;
  width: clamp(220px, min(38vw, 43dvh), 400px);
  aspect-ratio: 1;
}

.hero-mark img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 30px rgba(61, 51, 12, 0.12));
}

.orbit {
  position: absolute;
  inset: 4%;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 50%;
}

.orbit-one {
  transform: scaleX(1.28) rotate(14deg);
}

.orbit-two {
  transform: scaleY(1.23) rotate(-24deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-top: 4px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.075em;
  line-height: 0.95;
}

.hero-copy p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.5vw, 1.05rem);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
}

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

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

.section-shell {
  width: min(calc(100% - 48px), var(--max));
  margin-inline: auto;
}

.portfolio {
  padding-block: clamp(84px, 11vw, 152px);
}

.section-heading {
  max-width: 720px;
  margin-bottom: clamp(40px, 7vw, 80px);
}

.section-heading h2,
.about-copy h2,
.contact-copy h2 {
  max-width: 680px;
  margin: 0 0 20px;
  font-size: clamp(2.3rem, 5.2vw, 5rem);
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.section-heading p,
.about-copy p,
.contact-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.project-card {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  isolation: isolate;
}

.project-card:first-child {
  grid-column: 1 / -1;
  min-height: 560px;
}

.project-card:not(:first-child) {
  min-height: 380px;
}

.project-card:not(:first-child) .card-caption h3 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.project-card .media {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, var(--bg-soft) 22%, var(--surface) 44%, var(--bg-soft) 66%);
  background-size: 220% 100%;
}

.project-card .media::after {
  content: "Image unavailable";
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--muted);
}

.project-card .media.is-error::after {
  display: grid;
}

.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease, transform 650ms cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card .media.is-loaded img {
  opacity: 1;
}

.project-card:hover img,
.project-card:focus-visible img {
  transform: scale(1.035);
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  z-index: 1;
  background: linear-gradient(to bottom, transparent, rgba(18, 19, 17, 0.82));
  pointer-events: none;
}

.card-caption {
  position: relative;
  z-index: 2;
  align-self: end;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  padding: 24px;
  color: #f7f6ef;
}

.card-caption h3 {
  margin: 0 0 4px;
  font-size: clamp(1.4rem, 2.8vw, 2.35rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.card-caption p {
  margin: 0;
  color: rgba(247, 246, 239, 0.78);
  font-size: 0.85rem;
}

.card-open {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(247, 246, 239, 0.42);
  border-radius: 12px;
  background: rgba(21, 22, 20, 0.24);
  font-size: 1.15rem;
  line-height: 1;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  grid-template-areas: "copy note";
  align-items: end;
  gap: clamp(48px, 9vw, 132px);
  padding-block: clamp(84px, 12vw, 160px);
  border-top: 1px solid var(--line);
}

.about-copy {
  grid-area: copy;
  align-self: end;
}

.about-copy p + p {
  margin-top: 16px;
}

.about-expertise {
  margin-top: 32px;
}

.about-expertise h3 {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.expertise-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.expertise-list li {
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}

.about-note {
  grid-area: note;
  margin: 0;
  padding: 28px 0 4px;
  border-top: 1px solid var(--line);
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.035em;
}

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: clamp(48px, 9vw, 120px);
  padding-block: clamp(84px, 12vw, 160px);
  border-top: 1px solid var(--line);
}

.contact-copy .button {
  margin-top: 28px;
}

.contact-links {
  display: grid;
  align-content: start;
  gap: 32px;
}

.contact-link-group h3 {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.contact-shop-buttons,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-shop-buttons .button {
  gap: 16px;
}

.social-link {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.social-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.social-link:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.social-link:active {
  transform: translateY(1px);
}

.site-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding-block: 32px;
  border-top: 1px solid var(--line);
}

.site-footer img {
  width: 44px;
  height: 44px;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.project-dialog {
  width: min(calc(100% - 40px), 1180px);
  max-height: min(90dvh, 820px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.project-dialog::backdrop {
  background: rgba(13, 14, 12, 0.72);
  backdrop-filter: blur(7px);
}

.project-dialog[open] {
  animation: dialog-in 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(330px, 0.72fr);
  height: min(76dvh, 720px);
  min-height: 0;
}

.dialog-gallery {
  --gallery-ratio: 1.777777778;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.gallery-image-area {
  container-type: size;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.dialog-image-frame {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--gallery-ratio)));
  aspect-ratio: var(--gallery-ratio);
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.dialog-image-frame img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  transition: opacity 180ms ease, transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-image-frame img.is-switching {
  opacity: 0;
  transform: scale(0.985);
}

.gallery-controls {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.gallery-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0 0 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-arrow[hidden] { display: none; }
.gallery-previous { left: 12px; }
.gallery-next { right: 12px; }
.gallery-arrow:hover { background: var(--accent); color: var(--accent-ink); }
.gallery-arrow:active { transform: translateY(-50%) scale(0.96); }

.gallery-control {
  flex: 0 0 150px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.gallery-control[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface);
}

.gallery-control img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.dialog-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 60px 24px 20px;
  overflow: hidden;
}

.dialog-details {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--bg-soft);
}

.dialog-category {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dialog-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 2.5vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.dialog-details > p:not(.dialog-category) {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.project-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0 0;
}

.project-facts div {
  min-width: 0;
}

.project-facts dt {
  color: var(--muted);
  font-size: 0.73rem;
}

.project-facts dd {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.shop-actions {
  display: grid;
  flex-shrink: 0;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.shop-actions .button {
  min-height: 40px;
  font-size: 0.8rem;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 360px;
  padding: 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
}

.reveal {
  opacity: 1;
  transform: none;
}

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-mark {
    animation: hero-arrive 900ms cubic-bezier(0.16, 1, 0.3, 1) both, hero-float 5s 1s ease-in-out infinite;
  }

  .hero-copy {
    animation: copy-arrive 700ms 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .orbit-one {
    animation: orbit-one 18s linear infinite;
  }

  .orbit-two {
    animation: orbit-two 24s linear infinite reverse;
  }

  @keyframes hero-arrive {
    from { opacity: 0; transform: translateY(28px) scale(0.86) rotate(-3deg); }
    to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
  }

  @keyframes copy-arrive {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes hero-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -8px; }
  }

  @keyframes orbit-one {
    to { transform: scaleX(1.28) rotate(374deg); }
  }

  @keyframes orbit-two {
    to { transform: scaleY(1.23) rotate(336deg); }
  }
}

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

@media (prefers-reduced-transparency: reduce) {
  .project-dialog::backdrop {
    backdrop-filter: none;
    background: rgba(13, 14, 12, 0.9);
  }
}

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

  .project-card:first-child,
  .project-card:not(:first-child) {
    min-height: 380px;
  }

  .about,
  .contact {
    grid-template-columns: 1fr;
  }

  .about {
    grid-template-areas:
      "copy"
      "note";
  }

  .dialog-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .project-dialog {
    max-height: 92dvh;
    overflow-y: auto;
  }

  .gallery-image-area {
    container-type: normal;
    aspect-ratio: var(--gallery-ratio);
  }

  .dialog-image-frame {
    width: 100%;
  }

  .dialog-copy {
    overflow: visible;
  }

  .dialog-details {
    overflow: visible;
    flex: none;
  }
}

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

  .site-header {
    grid-template-columns: 1fr auto;
    width: calc(100% - 32px);
    height: 64px;
  }

  .nav-links {
    display: none;
  }

  .section-shell {
    width: calc(100% - 32px);
  }

  .hero {
    padding-inline: 16px;
  }

  .hero-mark {
    width: min(72vw, 38dvh, 320px);
  }

  .hero-copy {
    width: calc(100% - 32px);
  }

  .project-card:first-child,
  .project-card:not(:first-child) {
    min-height: min(118vw, 520px);
  }

  .card-caption {
    padding: 20px;
  }

  .about,
  .contact {
    gap: 42px;
  }

  .site-footer {
    grid-template-columns: auto 1fr;
  }

  .site-footer a {
    display: none;
  }

  .project-dialog {
    width: calc(100% - 20px);
    padding: 12px;
  }

  .dialog-gallery {
    padding: 10px;
  }

  .gallery-control {
    flex-basis: 90px;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 6px;
    font-size: 0.7rem;
    text-align: center;
  }

  .gallery-control img {
    width: 100%;
    height: 52px;
  }

  .dialog-copy {
    padding: 60px 16px 20px;
  }

  .project-facts {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .shop-actions {
    display: grid;
  }
}

@media (max-width: 360px) {
  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-copy p {
    font-size: 0.86rem;
  }

  .section-heading h2,
  .about-copy h2,
  .contact-copy h2 {
    font-size: 2.2rem;
  }
}
