/* ===========================================================================
   Anthony Josefsson — portfolio stylesheet

   Structure of this file:
     1. Fonts
     2. Design tokens (colors, type, spacing)  <- change the look here first
     3. Base / resets
     4. Reusable pieces (buttons, eyebrow labels, headings, chips)
     5. Layout sections (nav, hero, about, work, resume, footer)
     6. Project detail page
     7. Responsive
   =========================================================================== */

/* 1. FONTS ---------------------------------------------------------------- */

/* 2. DESIGN TOKENS -------------------------------------------------------- */

:root {
  /* Brand */
  --coral: #fa4e36;
  --coral-light: #fc6a50;
  --coral-dark: #e93d25;
  --coral-deep: #c9331c;
  --mustard: #ffc94d;

  /* Neutrals */
  --cream: #fdf6ee; /* page background */
  --cream-warm: #fdf1e6; /* resume band */
  --cream-light: #fff4ea; /* text on coral */
  --ink: #241e1a;
  --ink-soft: #4a4038;
  --ink-muted: #6b6058;
  --hairline: rgba(36, 30, 26, 0.12);

  /* Type */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Work Sans", system-ui, -apple-system, sans-serif;

  /* Layout */
  --max-wide: 1240px;
  --max-mid: 1100px;
  --max-narrow: 720px;
  --gutter: 48px;
  --radius: 16px;

  /* Vintage grain overlay, reused by every coral surface */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/></svg>");
}

/* Coral surfaces. Applied in index.html as e.g. class="hero surface-coral"
   so the gradient + grain recipe lives in exactly one place. */
.surface-coral {
  background-color: var(--coral);
  background-image:
    linear-gradient(
      170deg,
      var(--coral-light) 0%,
      var(--coral) 50%,
      var(--coral-dark) 100%
    ),
    var(--grain);
  background-blend-mode: overlay;
  background-size:
    cover,
    140px 140px;
  color: var(--cream-light);
}

.surface-coral--deep {
  background-color: var(--coral-dark);
  background-image:
    linear-gradient(
      170deg,
      var(--coral) 0%,
      var(--coral-dark) 55%,
      var(--coral-deep) 100%
    ),
    var(--grain);
  background-blend-mode: overlay;
  background-size:
    cover,
    140px 140px;
  color: var(--cream-light);
}
/* Variant 1 — soft cream glow, for light sections like About */
.surface-cream {
  background-color: var(--cream);
  background-image:
    radial-gradient(
      circle at 15% 20%,
      rgba(250, 78, 54, 0.12),
      transparent 55%
    ),
    radial-gradient(
      circle at 85% 75%,
      rgba(250, 78, 54, 0.08),
      transparent 60%
    ),
    var(--grain);
  background-blend-mode: overlay;
  background-size:
    cover,
    cover,
    140px 140px;
  color: var(--ink);
}

/* Variant 3 — dark ink with a coral glow, for a heavier closing section */
.surface-ink {
  background-color: var(--ink);
  background-image:
    radial-gradient(
      circle at 25% 20%,
      rgba(250, 78, 54, 0.35),
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(250, 78, 54, 0.18),
      transparent 55%
    ),
    var(--grain);
  background-blend-mode: overlay;
  background-size:
    cover,
    cover,
    140px 140px;
  color: var(--cream-light);
}

/* 3. BASE ----------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a {
  color: var(--coral);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--coral-dark);
}

::selection {
  background: var(--coral);
  color: var(--cream-light);
}

[hidden] {
  display: none !important;
}

/* Global safety net — let text and grid content shrink/wrap instead of
   forcing layouts wider than their container. Not viewport-specific, so
   it lives here rather than inside a media query. */
.card__row,
.card__title,
.footer__wordmark,
.timeline__role,
.timeline__org,
.timeline__desc {
  min-width: 0;
  overflow-wrap: break-word;
}
h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

/* 4. REUSABLE PIECES ------------------------------------------------------- */

/* Small uppercase label used above headings and in metadata */
.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 16px;
}
.eyebrow--accent {
  color: var(--coral);
}

.h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 42px;
  line-height: 1.15;
  margin: 0 0 28px;
}

/* Buttons — one base class plus a color variant */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 14px 26px;
  border-radius: 100px;
  border: 1.5px solid transparent;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}
.btn--dark {
  background: var(--ink);
  color: var(--cream-light);
}
.btn--dark:hover {
  background: #161210;
  color: var(--cream-light);
}
.btn--light {
  background: var(--cream);
  color: var(--coral);
  padding: 10px 20px;
  font-size: 11px;
}
.btn--light:hover {
  background: var(--ink);
  color: var(--cream-light);
}
.btn--ghost {
  color: var(--cream-light);
  border-color: rgba(255, 244, 234, 0.55);
}
.btn--ghost:hover {
  border-color: var(--cream-light);
  color: var(--cream-light);
}
.btn--outline {
  color: var(--ink);
  border-color: rgba(36, 30, 26, 0.25);
  font-size: 12px;
}
.btn--outline:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Pill list (skills) */
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 40px 0 0;
  padding: 0;
}
.chips li {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  border: 1px solid rgba(36, 30, 26, 0.2);
  padding: 8px 16px;
  border-radius: 100px;
}

/* Heading + trailing item on one baseline */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 48px;
}
.section-head .h2,
.section-head .eyebrow {
  margin-bottom: 0;
}

/* 5. LAYOUT SECTIONS ------------------------------------------------------ */

/* --- Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px var(--gutter);
}
.nav__brand {
  flex-shrink: 0;
  display: flex;
  order: 1;
}
.nav__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--cream-light);
  object-fit: cover;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
  order: 2;
}
.nav__links > a:not(.btn) {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream-light);
}
@media (min-width: 901px) {
  .nav__links {
    margin-left: auto;
  }
}
.nav__links > a:not(.btn):hover {
  color: var(--ink);
}
.nav__contact {
  order: 3;
}
.nav__toggle {
  order: 4;
  display: none;
}

/* --- Hero --- */
.hero {
  padding: 110px var(--gutter) 90px;
}
.hero__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__text {
  flex: 1;
  min-width: 300px;
}
.hero .eyebrow--accent {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--mustard);
  margin-bottom: 20px;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--cream-light);
  margin: 0 0 28px;
}
.hero__title em {
  font-style: italic;
  color: var(--ink);
}
.hero__lead {
  font-size: 19px;
  line-height: 1.6;
  color: rgba(255, 244, 234, 0.92);
  max-width: 520px;
  margin: 0 0 32px;
}
.hero__actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.hero__figure {
  width: 340px;
  flex-shrink: 0;
  margin-left: -30px;
}
.hero__figure img {
  height: 460px;
  object-fit: contain;
  margin-inline: auto;
}

/* --- About --- */
.about {
  padding: 96px var(--gutter);
}
.about__inner {
  max-width: var(--max-mid);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 64px;
}
.about__photo {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-warm);
}
.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about__body {
  padding-top: 6px;
}
.about__body p {
  color: var(--ink-soft);
  line-height: 1.75;
  margin: 0 0 20px;
}

/* --- Selected work --- */
.work {
  padding: 96px var(--gutter);
  max-width: var(--max-wide);
  margin: 0 auto;
}
.work__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}
.card {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.card__media {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: 20px;
  background: var(--cream-warm);
  transition: transform 0.2s ease;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.card:hover .card__media {
  transform: translateY(-4px);
}
.card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.card__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  margin: 0 0 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.card__meta,
.card__year {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  margin: 0;
}
.card__year {
  flex-shrink: 0;
}

.pull-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.35;
  max-width: 760px;
  margin: 96px auto 0;
  padding-top: 56px;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

/* --- Resume --- */
.resume {
  background: var(--cream-warm);
  padding: 96px var(--gutter);
}
.resume__inner {
  max-width: 1000px;
  margin: 0 auto;
}
.resume__block {
  margin-bottom: 56px;
}
.resume__block:last-child {
  margin-bottom: 0;
}

.timeline__row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--hairline);
}
.timeline__dates {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  line-height: 1.5;
}
.timeline__role {
  font-size: 17px;
  font-weight: 400;
  margin: 0 0 2px;
}
.timeline__org {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 10px;
}
.timeline__desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}

/* --- Footer --- */
.footer {
  padding: 64px var(--gutter) 40px;
}
.footer__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
}
.footer .eyebrow {
  color: var(--cream-light);
  opacity: 0.85;
}
.footer a {
  color: var(--cream-light);
}
.footer a:hover {
  color: var(--ink);
}
.footer__location {
  font-size: 15px;
  margin: 0;
  color: var(--cream-light);
}

.footer__cols {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 40px;
}
.footer__social {
  display: flex;
  gap: 12px;
}
.footer__social a {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 244, 234, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.footer__social a:hover {
  background: var(--cream-light);
  color: var(--coral);
}
.footer__meta {
  display: flex;
  gap: 64px;
  flex-wrap: wrap;
}
.footer__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
}

.footer__wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.footer__wordmark img {
  width: 200px;
  height: auto;
  aspect-ratio: 550 / 825;
  object-fit: contain;
  flex-shrink: 0;
}
.footer__wordmark span {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: normal;
  font-size: clamp(20px, 8vw, 38px);
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
}
.footer__copy {
  font-size: 13px;
  opacity: 0.75;
  margin: 40px 0 0;
  text-align: center;
}

/* 6. PROJECT DETAIL ------------------------------------------------------- */

.project {
  padding: 64px var(--gutter) 0;
}

.project__back {
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 32px;
}
.project__back:hover {
  color: var(--coral);
}

.project__head {
  max-width: 920px;
  margin: 0 auto 48px;
}
.project__tags {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.project__tags .eyebrow {
  margin: 0;
}
.project__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.project__tagline {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0;
}

.project__cover {
  max-width: var(--max-mid);
  margin: 0 auto 56px;
  aspect-ratio: 16 / 8.5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-warm);
}
.project__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#project-detail[data-id="thndr"] .project__cover img {
  object-position: center top;
}

.project__facts {
  max-width: 920px;
  margin: 0 auto 64px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 28px 0;
}
.project__facts dt {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.project__facts dd {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.project__prose {
  max-width: var(--max-narrow);
  margin: 0 auto 64px;
}
.project__prose .h2 {
  font-size: 22px;
  margin-bottom: 16px;
}
.project__prose p {
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0 0 12px;
}
.project__prose p:last-child {
  margin-bottom: 0;
}

.project__insights {
  max-width: 920px;
  margin: 0 auto 64px;
}
.project__insights .h2 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 24px;
}
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.insight {
  background: #fff;
  border: 1px solid rgba(36, 30, 26, 0.1);
  border-radius: 14px;
  padding: 28px 24px;
}
.insight__n {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--coral);
  margin: 0 0 12px;
}
.insight__text {
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.project__gallery {
  max-width: var(--max-mid);
  margin: 0 auto 64px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.project__gallery figure {
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cream-warm);
  margin: 0;
}
.project__gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project__outcome {
  max-width: var(--max-narrow);
  margin: 0 auto 80px;
  border-top: 1px solid var(--hairline);
  padding-top: 32px;
}
.project__outcome .h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

/* 7. RESPONSIVE ----------------------------------------------------------- */

@media (max-width: 900px) {
  :root {
    --gutter: 28px;
  }

  .about__inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .about__photo {
    aspect-ratio: 4 / 5;
  }
  .about__photo img {
    object-position: center top;
  }

  .work__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .card__media {
    margin-bottom: 10px;
  }
  .card__title {
    font-size: 15px;
  }
  .card__meta {
    font-size: 12px;
  }

  .insight-grid,
  .project__gallery {
    grid-template-columns: 1fr;
  }
  .project__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    padding: 72px var(--gutter) 64px;
  }
  .hero__figure {
    width: 100%;
  }
  .hero__figure img {
    height: 320px;
  }

  .about,
  .work,
  .resume {
    padding: 64px var(--gutter);
  }
  .footer {
    padding: 56px var(--gutter) 32px;
  }
  .footer__cols {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 32px;
    margin-bottom: 48px;
  }
  #about,
  #projects,
  #resume {
    scroll-margin-top: 90px;
  }
}

@media (max-width: 620px) {
  .nav {
    padding: 12px var(--gutter);
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .nav__brand {
    order: 1;
  }
  .nav__contact {
    order: 2;
  }
  .nav__toggle {
    order: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
  }
  .nav__toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--cream-light);
    border-radius: 2px;
  }
  .nav__links {
    order: 4;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    gap: 14px;
    transition: max-height 0.25s ease;
  }
  .nav__links.is-open {
    max-height: 300px;
    padding-top: 10px;
  }

  .footer__cols {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }
  .footer__wordmark {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 12px;
  }
  .footer__wordmark img {
    margin: 0 auto;
  }
  .footer__wordmark span {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: normal;
    font-size: clamp(26px, 9vw, 38px);
    text-align: center;
    max-width: 100%;
  }

  .timeline__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .project__facts {
    grid-template-columns: 1fr;
  }
}

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