/* ---------- Fonts ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-latin-400-normal.woff2")
    format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-latin-400-italic.woff2")
    format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

/* ---------- Design tokens: light is the default ---------- */
:root {
  --bg: #e5e7e0;
  --card: #ffffff;
  --border: #d3d6cd;
  --text: #161817;
  --muted: #5c615d;
  --btn-bg: #17191a;
  --btn-text: #efebe4;

  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-lg: 24px;
  --radius-pill: 999px;
  --page-width: 68rem;
}

/* Dark mode: follows the phone's setting unless the visitor chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e10;
    --card: #18191c;
    --border: #2a2c30;
    --text: #ecebe7;
    --muted: #8d9096;
    --btn-bg: #efebe4;
    --btn-text: #161817;
  }
}

/* Dark mode chosen with the toggle (added in a later step) */
:root[data-theme="dark"] {
  --bg: #0d0e10;
  --card: #18191c;
  --border: #2a2c30;
  --text: #ecebe7;
  --muted: #8d9096;
  --btn-bg: #efebe4;
  --btn-text: #161817;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  gap: 2rem;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.hero__photo {
  width: 100%;
  max-width: 15rem;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: top;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hero__name {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.hero__headline {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.hero__headline-soft {
  display: block;
  font-style: italic;
  color: var(--muted);
}

.hero__honest {
  max-width: 34rem;
  margin: 0 0 1.75rem;
  color: var(--muted);
}

/* ---------- Contact buttons ---------- */
.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact__link {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

/* ---------- Wider screens: text left, photo right ---------- */
@media (min-width: 48rem) {
  .hero {
    grid-template-columns: 1.4fr 1fr;
    align-items: center;
    gap: 4rem;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .hero__photo {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    max-width: 22rem;
  }

  .hero__text {
    grid-column: 1;
    grid-row: 1;
  }
}

/* ---------- Sections ---------- */
.section {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.section__title {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.section__foot {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Project cards ---------- */
.projects {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.project__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.project__status {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.project__line {
  margin: 0;
  color: var(--muted);
}

.project__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.2rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.link-btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-bg);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.link-btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

@media (min-width: 48rem) {
  .projects {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Header and theme toggle ---------- */

.site-header__name {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

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

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Light mode shows the moon, dark mode shows the sun */
.theme-toggle__sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle__sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

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

/* ---------- About ---------- */
.about {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  max-width: 40rem;
}

.about p {
  margin: 0;
  color: var(--muted);
}

.about .link-btn {
  margin-top: 0.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
}

.site-footer__title {
  max-width: 30rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.site-footer__legal {
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Sticky navbar ---------- */
html {
  scroll-padding-top: calc(4.5rem + env(safe-area-inset-top, 0px));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
}

/* Phones: no name in the bar, links sit on the left */
.site-header__name {
  display: none;
}

.nav {
  margin-right: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: inline-block;
  padding: 0.65rem 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-pill);
}

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

.nav__link:focus-visible {
  color: var(--text);
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.nav__link--resume {
  padding: 0.65rem 1.1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
}

.nav__link--resume:hover {
  color: var(--btn-text);
}

.nav__resume-item {
  display: none;
}

/* Wider screens: name on the left, links and button on the right */
@media (min-width: 36rem) {
  .site-header__name {
    display: inline;
    margin-right: auto;
  }

  .nav {
    margin-right: 0;
  }

  .nav__link {
    padding: 0.65rem 0.8rem;
  }
}

@media (min-width: 48rem) {
  .nav__resume-item {
    display: block;
  }
}

/* ---------- Icons ---------- */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

.contact__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
