/* ---------- Tokens (from Figma "Home" frame, 1920px wide) ---------- */
:root {
  --bg: #fff7f7;
  --ink: #484848;
  --rule: #d98ba0;            /* header rule: pink in Figma; adjust to match exactly */
  --hover: #851536;           /* nav hover color */
  --tile-bg: #ffffff;

  --font-display: "Abril Display", "Abril Fatface", Georgia, serif;

  --margin-left: 124px;
  --margin-right: 128px;
  --col-gap: 39px;            /* between tiles */
  --row-gap: 77px;            /* between tile rows */
  --logo-w: min(520px, 27vw);
  --logo-pad-right: 0.137;    /* blank space inside the logo file, right side (fraction of its width) */
  --nav-gap: 53px;            /* logo > rule > Work > About Me > Contact */
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; }

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: flex-start;
  gap: var(--nav-gap);
  padding-right: var(--margin-right);
}

/* Empty slot (520 x 291 in Figma): drop your logo <img> inside */
.logo {
  display: block;
  flex-shrink: 0;
  width: 474px;
  height: 237px;
  padding-top: 54px;
  margin-left: 30px;
}
.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Rule + nav sit in one row, vertically centered 140px from the top */
.header-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* keeps nav on the right now that the rule is gone */
  gap: var(--nav-gap);
  margin-top: clamp(40px, 7.3vw, 140px);
  /* pull the rule left so the gap from the logo art matches the gap on the nav side */
  margin-left: calc(var(--logo-w) * var(--logo-pad-right) * -1);
  min-height: 53px;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: var(--nav-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: block;
  font-size: clamp(14px, 1.15vw, 22px);
  line-height: normal;
  white-space: nowrap;
}
.site-nav a { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.site-nav a:hover { color: var(--hover); }

.site-nav .contact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.83em;              /* 140px at 24px */
  height: 2.2em;              /* 53px at 24px */
  font-size: clamp(15px, 1.25vw, 24px);
  border: 1px solid var(--ink);
}
.site-nav .contact:hover {
  background: var(--hover);
  border-color: var(--hover);
  color: #fff;
}

/* ---------- Work grid: 3 x 3, tiles 530px square ---------- */
main {
  padding: clamp(24px, 5.3vw, 102px) var(--margin-right) clamp(60px, 8.5vw, 164px) var(--margin-left);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--col-gap);
  row-gap: var(--row-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--tile-bg);
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Hover: pink overlay (40%), project name, slight zoom */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hover);   /* #851536 */
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tile-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.125vw, 45pt);
  line-height: 1.1;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tile:hover img,
.tile:focus-visible img { transform: scale(1.05); }
.tile:hover::after,
.tile:focus-visible::after { opacity: 0.4; }
.tile:hover .tile-label,
.tile:focus-visible .tile-label { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  :root { --margin-left: 5vw; --margin-right: 5vw; --col-gap: 2.5vw; --row-gap: 4vw; --nav-gap: 3vw; }
}

@media (max-width: 800px) {
  :root { --margin-left: 20px; --margin-right: 20px; --col-gap: 14px; --row-gap: 14px; --nav-gap: 20px; }
  .site-header { flex-wrap: wrap; padding-left: 20px; }
  .logo { width: 220px; }
  .header-bar { flex-basis: 100%; margin-top: 0; margin-left: 0; }
  .site-nav { margin-left: auto; }
  .site-nav a { font-size: 15px; }
  .site-nav .contact { font-size: 15px; }
  .work-grid { grid-template-columns: repeat(2, 1fr); }
}


/* =====================================================
   PROJECT PAGE: Bodoni Specbook (from Figma, 1920px)
   ===================================================== */
:root {
  --font-body: "Afacad", "Helvetica Neue", Arial, sans-serif;
  --project-gap: 47px;        /* vertical gap between images */
  --project-col-gap: 179px;   /* space between image column and text column */
  --title-color: #851436;
}

main.project {
  padding-top: 0;
  padding-bottom: clamp(60px, 7.3vw, 141px);
}

/* Back arrow (sits 56px under the header, 7px left of the page margin) */
.back-link {
  display: block;
  width: 24px;
  height: 24px;
  margin: clamp(16px, 2.9vw, 56px) 0 0 -7px;
  color: var(--ink);
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--hover); }
.back-link svg { display: block; }

/* Two columns: images (818px) | text (~675px) */
.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 818fr) minmax(0, 671fr);
  column-gap: var(--project-col-gap);
  align-items: start;
  margin-top: clamp(32px, 5vw, 97px);
}

/* Left column: images */
.project-media {
  display: flex;
  flex-direction: column;
  gap: var(--project-gap);
}
.media {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #d9d9d9;        /* placeholder fill until images are added */
}
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media--sketches { width: 65.2%; aspect-ratio: 533 / 400; }   /* 533 x 400 */
.media--mockup   { aspect-ratio: 818 / 656; }                 /* 818 x 656 */

.media-row {
  display: grid;
  grid-template-columns: 248fr 535fr;                          /* cover 248 + 37 gap + spread 535 */
  column-gap: calc(37 / 820 * 100%);
  aspect-ratio: 820 / 416;
}
.media-row .media { height: 100%; }

/* Right column: text */
.project-text {
  font-family: var(--font-body);
  color: #000;
}
.project-text h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 2.5vw, 48px);
  line-height: 64px;
  color: var(--title-color);
  margin: 0 0 31px;
}
.project-text h2 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(18px, 1.2vw, 23px);
  line-height: normal;
  margin: 0 0 4px;
}
.project-text p {
  font-size: clamp(15px, 0.94vw, 18px);
  line-height: 1.35;
  margin: 0 0 21px;
}
.project-text .project-type {
  font-weight: 500;
  font-size: clamp(16px, 1.04vw, 20px);
  line-height: 23px;
  margin: 0;
}

@media (max-width: 1400px) {
  :root { --project-col-gap: 9vw; --project-gap: 3.4vw; }
}

@media (max-width: 900px) {
  :root { --project-col-gap: 0px; --project-gap: 20px; }
  .project-layout { grid-template-columns: 1fr; row-gap: 32px; }
  .project-text { order: -1; }
  .project-text h1 { font-size: 36px; line-height: 1.2; margin-bottom: 20px; }
  .project-text h2 { font-size: 20px; }
  .project-text p { font-size: 16px; }
  .media--sketches { width: 100%; }
}


/* =====================================================
   PROJECT PAGE: Baking Bifold (extra modifiers only)
   ===================================================== */
.project-media--tight  { gap: calc(var(--project-gap) * 0.68); }   /* 32px between images */
.project-media--offset { margin-top: 7px; }                         /* images start 7px below the title */
.media--wide           { aspect-ratio: 818 / 438; }                 /* 818 x 438 */


/* =====================================================
   PROJECT PAGE: The Archive (extra modifiers only)
   ===================================================== */
.project-media--roomy { gap: calc(var(--project-gap) * 1.15); }     /* 54px between the two images */


/* Baking Bifold: images cropped exactly as placed in Figma
   (position and size are percentages of the frame, set inline per image) */
.media--crop img {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  max-width: none;
}


/* =====================================================
   PROJECT PAGE: Glow Stick Alphabet (extra modifier only)
   ===================================================== */
.project-text--compact h1 { line-height: 51px; margin-bottom: 25px; }   /* text starts 76px under the title's top */


/* =====================================================
   PROJECT PAGES: Apple Weather, Louise Fili, Logo Design
   (extra modifiers only)
   ===================================================== */
.project-text--apple  h1 { line-height: 51px; margin-bottom: 32px; }   /* body starts 83px under the title's top */
.project-text--louise h1 { line-height: 49px; margin-bottom: 25px; }   /* body starts 74px under the title's top */

.project-media--wide-gap { gap: calc(var(--project-gap) * 1.32); }     /* 62px between images */
.media--tall { aspect-ratio: 818 / 640; }                              /* 818 x 640 */

.media-pair {                                                          /* two 389 x 341 squares side by side */
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: calc(38 / 816 * 100%);
  aspect-ratio: 816 / 341;
}
.media-pair .media { height: 100%; }


/* =====================================================
   PROJECT PAGE: UX Case Study
   Each section is a grid row: images on the left, text on the right,
   with a thin vertical line connecting one section to the next.
   ===================================================== */
.cs-grid {
  display: grid;
  grid-template-columns: minmax(0, 818fr) minmax(0, 671fr);
  column-gap: var(--project-col-gap);
  margin-top: clamp(32px, 5vw, 97px);
}

.cs-media {
  grid-column: 1;
  align-self: start;
  margin-top: var(--mo, 0px);
}
.cs-media--stack { display: flex; flex-direction: column; gap: calc(var(--project-gap) * 1.57); }  /* 74px */

.cs-section {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: #000;
  /* section height from Figma (title to next title), scaled with the window width */
  min-height: min(calc(var(--h) * 1px), calc(var(--h) * 0.0520833vw));
}
.cs-section h1,
.cs-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 2.5vw, 48px);
  line-height: 51px;
  color: var(--title-color);
  margin: 0 0 20px;
}
.cs-section p { font-size: clamp(15px, 0.94vw, 18px); line-height: 1.35; margin: 0 0 21px; }
.cs-section p strong { font-weight: 600; }
.cs-section ul { margin: 0 0 21px; padding-left: 27px; font-size: clamp(15px, 0.94vw, 18px); line-height: 1.35; }
.cs-section .project-type { font-weight: 500; font-size: clamp(16px, 1.04vw, 20px); line-height: 23px; margin: 0; }

/* the last paragraph or list in a section carries no bottom margin, so the line's top gap is exact */
.cs-section > p:nth-last-child(2),
.cs-section > ul:nth-last-child(2) { margin-bottom: 0; }

/* the vertical connector: fills the space left in its section, with the
   same gap above (under the text) and below (above the next title) */
.cs-line {
  flex: 1 1 auto;
  display: block;
  min-height: clamp(44px, 3.4vw, 65px);
  width: 0;
  margin: 14px 0 14px 105px;
  border-left: 1px solid var(--title-color);
  opacity: 0.7;
}

/* image sizes (Figma) */
.media--cs-hero     { aspect-ratio: 815 / 640; }
.media--cs-chart    { aspect-ratio: 818 / 390; }
.media--cs-redesign { aspect-ratio: 817 / 904; }
.media--cs-mock1    { aspect-ratio: 816 / 459; }
.media--cs-mock2    { aspect-ratio: 817 / 460; }

.cs-pair { display: grid; align-items: start; }
.cs-pair--persona { grid-template-columns: 386fr 391fr; column-gap: calc(41 / 818 * 100%); }
.cs-pair--proto   { grid-template-columns: 396fr 391fr; column-gap: calc(31 / 818 * 100%); }
.media--cs-persona  { aspect-ratio: 386 / 517; }
.media--cs-affinity { aspect-ratio: 391 / 470; }
.media--cs-proto    { aspect-ratio: 396 / 290; }

@media (max-width: 900px) {
  .cs-grid { grid-template-columns: 1fr; row-gap: 24px; }
  .cs-grid > * { grid-column: 1; grid-row: auto !important; }
  .cs-section { min-height: 0; }
  .cs-section h1, .cs-section h2 { font-size: 32px; line-height: 1.2; }
  .cs-section p, .cs-section ul { font-size: 16px; }
  .cs-line { display: none; }
  .cs-media { margin-top: 0; }
}


/* Homepage tiles that use a cropped high-res image (crop set inline, as in Figma) */
.tile--crop img {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  max-width: none;
}


/* =====================================================
   PAGE: About Me + Contact (Figma "About Me" frame)
   Photo 818 x 850; Contact block starts 65px under the bio.
   Nav Contact link goes to about.html#contact.
   ===================================================== */
.media--about { aspect-ratio: 818 / 850; }
.project-text--about h1 { line-height: 49px; margin-bottom: 25px; }   /* body starts 74px under the title's top */

.about-contact {
  margin-top: 65px;
  scroll-margin-top: 32px;      /* keeps the heading clear of the top when jumped to from the nav */
}
.about-contact h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 2.5vw, 48px);
  line-height: 49px;
  color: var(--title-color);
  margin: 0 0 25px;
}
.about-contact p { margin: 0; }
.about-contact strong { font-weight: 600; }
.about-contact a { transition: color 0.2s ease; }
.about-contact a:hover { color: var(--hover); }

@media (max-width: 900px) {
  .project-layout .project-text--about { order: 0; }   /* photo first on the About page */
  .about-contact { margin-top: 40px; }
  .about-contact h2 { font-size: 32px; line-height: 1.2; margin-bottom: 12px; }
}

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