/* ===========================================================================
   Aidan Leather — portfolio
   Desktop composition translated from Figma (mobile comes later).
   =========================================================================== */

@font-face {
  font-family: "Uncut Sans";
  src: url("../fonts/UncutSans-Variable.ttf") format("truetype-variations"),
       url("../fonts/UncutSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f0f0f3;
  --ink: #151515;
  --surface: #e2e2e2;
  --tag-text: #555;
  --tag-border: #bbb;
  --read-bg: rgba(150, 187, 255, 0.2);
  --read-text: #3044e2;
  --btn-blue: #dee5f5;
  --guide: #e2e2e2;
  /* Scrubber bars: light grey at rest, dark on the active line.
     belt.js paints these per-frame (two colours, sizes bulge). */
  --scrub: #e2e2e2;
  --scrub-active: #444444;

  --card-size: 544px;
  --media-size: 400px;
  --radius-card: 8px;
  --radius-media: 5px;

  /* Left/right gutters scale down on smaller desktops but cap at the
     Figma values on a full 1728px frame. */
  --pad-left: clamp(32px, 24.5vw, 424px);
  --pad-right: clamp(32px, 18vw, 312px);

  font-family: "Uncut Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* --- stage: fixed full-viewport composition (the page does not scroll) -- */
.stage {
  position: relative;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* --- left writing column ----------------------------------------------- */
.column {
  flex: none;
  width: 320px;
  display: flex;
  flex-direction: column;
  padding-block: 100px;
  margin-right: clamp(48px, 8vw, 128px);
}

.intro__home {
  display: block;
  width: 48px;
  margin-bottom: 40px;
  line-height: 0;
}
.intro__avatar {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.intro__bio {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}
.intro__bio p { margin: 0 0 16px; }
.intro__bio p:last-child { margin-bottom: 0; }
.intro__bio strong { font-weight: 700; }

.intro__actions {
  display: flex;
  gap: 8px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.85; }
.btn--dark { background: var(--ink); color: var(--bg); }
.btn--blue { background: var(--btn-blue); color: var(--read-text); }

.divider {
  height: 0;
  margin: 40px 0 32px;
  border: none;
  border-top: 1px dashed var(--guide);
}

/* Read link is pinned to the bottom of the column. */
.read { width: 320px; max-width: 100%; margin-top: auto; }
.read__link {
  display: block;
  background: var(--read-bg);
  color: var(--read-text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
}
.read__link strong { font-weight: 700; }

/* --- vertical conveyor belt -------------------------------------------- */
.belt {
  flex: none;
  width: var(--card-size);
  align-self: stretch;          /* full viewport height; cards clipped */
  position: relative;
  overflow: hidden;
}

.belt__track {
  display: flex;
  flex-direction: column;
  gap: 32px;
  will-change: transform;
}

.card {
  position: relative;
  flex: 0 0 var(--card-size);
  width: var(--card-size);
  height: var(--card-size);
  background: var(--surface);
  border-radius: var(--radius-card);
  overflow: hidden;
}

/* Inset as percentages (of the square card) so cards scale at any width.
   At 544px these resolve to the original 56/72/400px. */
.card__media {
  position: absolute;
  top: 10.294%;
  left: 13.235%;
  width: 73.529%;
  height: 73.529%;
  border-radius: var(--radius-media);
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.card__tags {
  position: absolute;
  bottom: 8.456%;
  left: 13.235%;               /* left-aligned under the image */
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--tag-text);
  border-radius: 4px;
}
.tag--plain { padding: 4px 0; }
.tag--outline {
  padding: 4px 12px;
  border: 1px solid var(--tag-border);
}

/* --- selected clients (in the writing column) -------------------------- */
.clients__label {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.clients__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* --- vertical scrubber ------------------------------------------------- */
/* A fixed-width rail so changing bar lengths never shift the layout. The bar
   lengths + colour are driven per-frame in belt.js (a subtle bulge around the
   active card that eases toward the pointer on hover). */
.scrubber {
  flex: none;
  align-self: flex-start;
  margin-top: 156px;                  /* sits level with the intro */
  margin-left: clamp(32px, 4vw, 64px);
  width: 56px;
  box-sizing: content-box;
  padding-block: 14px;                /* enlarges the hover target */
  display: flex;
  flex-direction: column;
  align-items: flex-end;              /* bars anchored right; grow leftward */
  justify-content: center;
  gap: 4px;                           /* tight, calm rail */
  cursor: pointer;
  touch-action: none;                 /* let pointer events drive the scrub */
  user-select: none;
  outline: none;
}
.scrubber__bar {
  width: 32px;                        /* base length; belt.js sets per-frame */
  height: 4px;
  border-radius: 100px;
  background: var(--scrub);
  pointer-events: none;               /* the rail captures the pointer, not bars */
}
.scrubber:focus-visible { box-shadow: 0 0 0 2px var(--read-text); border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .belt__track { will-change: auto; }
}

/* ===========================================================================
   Project detail page — same writing column (pinned), scrolling case study.
   =========================================================================== */
.project {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* The shared .column pins to the viewport while the case study scrolls. */
.project .column {
  position: sticky;
  top: 0;
  height: 100vh;
}

.project__content {
  flex: none;
  width: var(--card-size);            /* 544px, aligned with the homepage belt */
  padding-block: 100px 120px;         /* top in line with the photo */
}

.project__hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  margin-bottom: 48px;
}

.project__title {
  margin: 0 0 16px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.5;
}

.project__back {
  flex: none;
  align-self: flex-start;
  margin-top: 100px;                  /* in line with the photo + hero top */
  margin-left: clamp(32px, 4vw, 64px);
  width: 56px;                        /* mirrors the scrubber's footprint */
  color: var(--read-text);
  font-size: 16px;
  line-height: 1.5;
}
.project__back:hover { text-decoration: underline; }

/* --- rich-text body (CKEditor 5 output) -------------------------------- */
.richtext { font-size: 16px; line-height: 1.5; }
.richtext > *:first-child { margin-top: 0; }
.richtext p { margin: 0 0 1em; }
.richtext h2, .richtext h3, .richtext h4 {
  font-weight: 700;
  line-height: 1.5;
  margin: 1.5em 0 0.4em;
}
.richtext h2 { font-size: 24px; }
.richtext h3 { font-size: 20px; }
.richtext h4 { font-size: 16px; }
.richtext a { color: var(--read-text); text-decoration: underline; }
.richtext ul, .richtext ol { margin: 0 0 1em; padding-left: 1.25em; }
.richtext li { margin-bottom: 0.25em; }
.richtext blockquote {
  margin: 1.5em 0;
  padding-left: 16px;
  border-left: 3px solid var(--guide);
  color: var(--tag-text);
}
.richtext figure { margin: 1.5em 0; }
.richtext img,
.richtext figure.image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-media);
}
/* Embedded video (CKEditor media embed). */
.richtext iframe,
.richtext figure.media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-media);
}
.richtext figcaption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--tag-text);
}
.richtext table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
.richtext th, .richtext td {
  border: 1px solid var(--tag-border);
  padding: 8px 12px;
  text-align: left;
}

/* ===========================================================================
   Mobile: collapse to a single scrolling column (≤768px).
   Sidebar stacks above the main content; the belt becomes a plain vertical
   stack of full-width cards (no auto-scroll, no scrubber — native scroll).
   =========================================================================== */
@media (max-width: 768px) {
  /* --- homepage --- */
  .stage {
    flex-direction: column;
    justify-content: flex-start;     /* avoid centred-flex overflow clipping */
    height: auto;
    overflow: visible;
    padding: 40px 24px 64px;
  }
  .column {
    width: auto;
    margin-right: 0;
    padding-block: 0;
  }
  .read { margin-top: 32px; }        /* margin-top:auto is inert in flow now */

  .belt {
    width: auto;
    overflow: visible;
    margin-top: 40px;
  }
  .belt__track { gap: 24px; }
  /* Stack the card contents in normal flow on mobile (the desktop absolute/
     percentage layout cramps the chips against the image on small cards). */
  .card {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    gap: 16px;
  }
  .card__media {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .card__tags {
    position: static;
  }

  .scrubber { display: none; }       /* native scroll replaces it */

  /* --- project page --- */
  .project {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 40px 24px 64px;
  }
  .project .column { position: static; height: auto; }
  .project__back {
    order: 1;                        /* sidebar → back → content */
    width: auto;
    margin: 24px 0 0;
  }
  .project__content {
    order: 2;
    width: auto;
    padding-block: 32px 0;
  }
  .project__title { font-size: 28px; }
}
