:root {
  color-scheme: light;
  --bg: #f4f3ee;
  --bg-rgb: 244 243 238;
  --surface: #e9e8e1;
  --surface-strong: #dfded6;
  --text: #252821;
  --muted: #676b60;
  --line: #d6d7cf;
  --line-strong: #b8bbb2;
  --accent: #3f6258;
  --accent-contrast: #f1efe7;
  --focus: #6d6650;
  --shadow: 0 18px 48px rgb(37 40 33 / 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    Georgia, serif;
  --nav-height: 72px;
  --scroll-padding: 96px;
  --transition: 250ms ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #191b18;
    --bg-rgb: 25 27 24;
    --surface: #22251f;
    --surface-strong: #2a2e27;
    --text: #e8e5dc;
    --muted: #aaa79d;
    --line: #383b34;
    --line-strong: #4d5148;
    --accent: #a8beb2;
    --accent-contrast: #20241f;
    --focus: #c7b77e;
    --shadow: 0 18px 48px rgb(19 21 18 / 0.24);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191b18;
  --bg-rgb: 25 27 24;
  --surface: #22251f;
  --surface-strong: #2a2e27;
  --text: #e8e5dc;
  --muted: #aaa79d;
  --line: #383b34;
  --line-strong: #4d5148;
  --accent: #a8beb2;
  --accent-contrast: #20241f;
  --focus: #c7b77e;
  --shadow: 0 18px 48px rgb(19 21 18 / 0.24);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--scroll-padding);
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root.theme-transition *,
:root.theme-transition *::before,
:root.theme-transition *::after {
  transition-duration: var(--transition);
  transition-property: background-color, border-color, color, box-shadow, opacity,
    transform;
  transition-timing-function: ease;
}

body,
h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
}

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

button {
  font: inherit;
}

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

[id] {
  scroll-margin-top: var(--scroll-padding);
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  transform: translateY(-180%);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}

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

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 2px;
  pointer-events: none;
}

.scroll-progress__bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.container {
  width: min(calc(100% - 2rem), 1120px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  border-bottom: 1px solid transparent;
  background: transparent;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgb(var(--bg-rgb) / 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header.is-scrolled {
    background: rgb(var(--bg-rgb) / 0.96);
  }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 2rem), 1120px);
  height: 100%;
  margin-inline: auto;
  gap: 1rem;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 2vw, 1rem);
}

.nav__links a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1;
  text-decoration: none;
}

.nav__links a {
  padding: 0.55rem 0.35rem;
}

.nav__links a:hover,
.nav__brand:hover,
.theme-toggle:hover {
  color: var(--text);
}

.nav__brand[aria-current="page"],
.nav__links a[aria-current="page"] {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.42em;
}

.theme-toggle {
  gap: 0.35rem;
  padding: 0.35rem 0 0.35rem 0.35rem;
  cursor: pointer;
}

.theme-toggle__icon {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1;
}

.theme-toggle:hover .theme-toggle__icon {
  color: var(--text);
}

.theme-toggle__switch {
  position: relative;
  display: inline-flex;
  width: 2.35rem;
  height: 1.24rem;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.theme-toggle__knob {
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 0.76rem;
  height: 0.76rem;
  border-radius: 50%;
  background: var(--accent);
}

:root[data-theme="dark"] .theme-toggle__knob {
  transform: translateX(1.08rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__knob {
    transform: translateX(1.08rem);
  }
}

.hero {
  padding-block: clamp(4.75rem, 13vw, 8.5rem) clamp(4.5rem, 9vw, 7rem);
}

.hero__inner {
  max-width: 860px;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0;
}

h1,
h2 {
  font-family: var(--font-serif);
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.85rem, 7vw, 4.25rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.08;
}

h3 {
  font-size: 1rem;
  line-height: 1.3;
}

.hero__title {
  margin-top: 1.1rem;
  color: var(--accent);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  font-weight: 500;
}

.hero__copy {
  max-width: 740px;
  margin-top: clamp(1.5rem, 3vw, 2rem);
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.14rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: clamp(2rem, 4vw, 2.8rem);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  border: 1px solid transparent;
  padding: 0.78rem 1.05rem;
  font-size: 0.94rem;
  line-height: 1.1;
  text-decoration: none;
}

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

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

.button:hover {
  transform: translateY(-1px);
}

.section {
  padding-block: clamp(4.75rem, 9vw, 7.5rem);
}

.section--ruled,
.site-footer {
  border-top: 1px solid var(--line);
}

.section__grid {
  display: grid;
  grid-template-columns: minmax(12rem, 0.62fr) minmax(0, 1.38fr);
  gap: clamp(2.5rem, 7vw, 6rem);
}

.section__heading {
  max-width: 22rem;
}

.section__heading--wide {
  max-width: 100%;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.section__body {
  max-width: 760px;
}

.section__body p + p {
  margin-top: 1.2rem;
}

.section__body,
.section__lede,
.bring-item p,
.site-footer {
  color: var(--muted);
}

.section__lede {
  max-width: 560px;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.credibility {
  border-block: 1px solid var(--line);
  padding-block: 1rem;
}

.credibility__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  list-style: none;
}

.bring-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.bring-item {
  min-height: 15rem;
  padding: clamp(1.4rem, 3vw, 2.2rem);
}

.bring-item + .bring-item {
  border-left: 1px solid var(--line);
}

.bring-item p {
  margin-top: 1rem;
}

#work {
  padding-block: 80px;
}

.work__intro {
  margin-bottom: 40px;
}

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

.project-tile {
  display: grid;
  align-content: start;
  gap: 20px;
  border-radius: 16px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  outline-offset: 6px;
}

.project-tile:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 6px;
}

.project-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
}

.project-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 200ms ease;
}

.project-tile__content {
  display: grid;
  gap: 0.2rem;
}

.project-tile h3 {
  color: var(--text);
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
  font-weight: 500;
  transition: transform 200ms ease;
}

.project-tile:hover .project-image,
.project-tile:focus-visible .project-image {
  transform: scale(1.02);
}

.project-tile:hover h3,
.project-tile:focus-visible h3 {
  transform: translateY(-2px);
}

.project-tile__category {
  color: var(--muted);
  font-size: 0.94rem;
}

.project-tile__tags {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.project-page {
  min-height: 100vh;
}

.project-page__content {
  max-width: 760px;
}

.project-page__content > p {
  max-width: 640px;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.project-page__actions,
.project-page__cards {
  margin-top: clamp(2rem, 4vw, 2.8rem);
}

.project-page__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 720px;
}

.project-page__card {
  display: flex;
  align-items: center;
  min-height: 5.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.portfolio-back-link {
  display: inline-flex;
  align-items: center;
  width: max-content;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-block: 0.35rem;
  transition: border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.portfolio-back-link:hover,
.portfolio-back-link:focus-visible {
  color: var(--text);
  border-bottom-color: currentColor;
  transform: translateY(-1px);
}

.portfolio-back-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.project-page--learning .project-page__content {
  margin-inline: auto;
  text-align: left;
}

.project-page--learning .project-page__content > p {
  margin-left: 0;
  margin-right: 0;
}

.project-page--learning .project-page__cards {
  margin-inline: auto;
}

.project-page--learning .project-page__cards {
  justify-content: center;
}

.project-page--learning .project-page__actions {
  display: flex;
  justify-content: center;
}

.project-page--learning .project-page__card {
  justify-content: center;
  text-align: center;
  transition: background-color 200ms ease, border-color 200ms ease,
    transform 200ms ease;
}

.project-page--learning .project-page__card:hover,
.project-page--learning .project-page__card:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface);
  transform: translateY(-2px);
}

.project-page__card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

#contact {
  padding-top: calc(clamp(4.75rem, 9vw, 7.5rem) - 24px);
  padding-bottom: clamp(4.75rem, 9vw, 7.5rem);
}

.contact-actions {
  display: grid;
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
  border-top: 1px solid var(--line);
}

.contact-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  border-bottom: 1px solid var(--line);
  padding-block: clamp(1.05rem, 2.6vw, 1.45rem);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.contact-action:hover,
.contact-action:focus-visible {
  border-bottom-color: var(--line-strong);
  background: var(--surface);
}

.contact-action span:last-child {
  color: var(--muted);
  flex: 0 0 auto;
}

.site-footer {
  padding-block: 2.2rem;
}

.footer__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer__name {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.site-footer p + p {
  margin-top: 0.2rem;
}

@media (max-width: 760px) {
  :root {
    --nav-height: 68px;
    --scroll-padding: 88px;
  }

  .container,
  .nav {
    width: min(calc(100% - 1.25rem), 1120px);
  }

  .section__grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .section__heading {
    max-width: 100%;
  }

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

  .bring-item {
    min-height: auto;
    padding-inline: 0;
  }

  .bring-item + .bring-item {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .footer__inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

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

@media (max-width: 560px) {
  .nav__links {
    gap: 0.15rem;
  }

  .nav__links a {
    padding-inline: 0.28rem;
    font-size: 0.86rem;
  }

  .theme-toggle {
    padding-left: 0.2rem;
  }

  .hero__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
