/* ==========================================================================
   jasonfrade.com — shared styles
   Palette: Oak & stone. Cards: colour field (a tinted panel, no mark).
   ========================================================================== */

:root {
  /* Paper & ink */
  --paper:    #F5F0E7;
  --paper-2:  #EDE6DB;
  --ink:      #2A2724;
  --ink-soft: #625B53;
  /* Secondary text on the project colours: #625B53 drops to 2.9:1 on walnut,
     this stays above 5:1 on all four */
  --ink-soft-on-colour: #3D3832;
  --rule:     #E0D8CB;
  --edge:     rgba(42,39,36,.16);
  --dots:     radial-gradient(rgba(42,39,36,.075) 1px, transparent 1.1px);

  /* Oak & stone: project colours */
  --oak:    #B88B60;
  --sage:   #7F8A74;
  --stone:  #AFA091;
  --walnut: #4B3E33;

  /* Oak is too light for text on paper (2.7:1), so accent text uses a darker oak (4.8:1) */
  --accent:      var(--oak);
  --accent-text: #86633F;

  /* Type: two families only */
  --font-display: "Jost", "Futura", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --shadow:    0 1px 3px rgba(42,39,36,.08), 6px 10px 24px rgba(42,39,36,.16);
  --shadow-sm: 0 1px 2px rgba(42,39,36,.08), 4px 8px 18px rgba(42,39,36,.16);

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 680px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.7 var(--font-display);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--walnut); text-underline-offset: 3px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* Type primitives */
.label {
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; margin: 0; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tags li {
  font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); padding: 7px 10px; border: 1px solid var(--rule); border-radius: 999px;
}

/* Site nav & footer */
.site-nav { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; }
.mark { display: flex; align-items: center; gap: 12px; font: 500 15px var(--font-display); letter-spacing: .06em; color: var(--ink); text-decoration: none; }
.mark .disc { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); position: relative; flex: none; }
.mark .disc::after { content: ""; position: absolute; inset: 6px 6px 6px 13px; background: var(--oak); border-radius: 0 13px 13px 0; }
.site-nav ul { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0; font-size: 15px; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--rule); padding: 40px 0 56px; margin-top: 96px; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }

.footer-links { display: inline-flex; align-items: center; gap: 20px; }
.footer-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--ink-soft); transition: color .2s; }
.footer-icon svg { width: 18px; height: 18px; fill: currentColor; }
.footer-icon:hover { color: var(--ink); }
.footer-icon:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 2px; }

/* Email address as a button that copies it */
.copy-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0; border: 0; background: none; font-family: inherit; font-size: inherit; line-height: inherit; color: var(--walnut); cursor: pointer; }
.copy-btn.label { font: 500 12px/1.4 var(--font-mono); color: var(--ink-soft); }
.copy-btn .copy-text { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.copy-btn:hover { color: var(--ink); }
.copy-btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 2px; }
.copy-icon { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.copy-icon .icon-check { display: none; }
.copy-btn.is-copied .icon-copy { display: none; }
.copy-btn.is-copied .icon-check { display: inline; }
.copy-btn.is-copied::after { content: "Copied"; position: absolute; right: 0; bottom: calc(100% + 4px); padding: 4px 8px; border-radius: 4px; background: var(--ink); color: var(--paper); font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ==========================================================================
   Project cards: a panel tinted with the project colour (--c), work on top
   ========================================================================== */

.project-card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 540px; overflow: hidden;
                border-radius: 12px; color: inherit; text-decoration: none; --c: var(--oak);
                background: color-mix(in srgb, var(--c) 36%, var(--paper-2)); }
.project-card .info { display: flex; flex-direction: column; padding: clamp(28px, 4vw, 56px); }
.project-card h3 { font-size: clamp(28px, 3vw, 38px); line-height: 1.15; font-weight: 300; margin: 14px 0 0; max-width: 18ch; }
.card-results { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: auto 0 0; padding: 32px 0 28px;
                border-top: 1px solid rgba(42, 39, 36, .16); }
.card-results li { display: grid; gap: 8px; align-content: start; }
.card-results b { font-weight: 300; font-size: clamp(36px, 4vw, 48px); line-height: 1; letter-spacing: -.02em; }
.card-results span { font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
/* The screenshot starts inside the card and runs off its right and bottom edges */
.project-card .stage { position: relative; overflow: hidden; }
.project-card .stage img { position: absolute; left: 4%; top: 14%; width: 118%; max-width: none; border: 1px solid var(--edge);
                           border-radius: 10px; box-shadow: var(--shadow); transition: transform .4s var(--ease); }
.project-card:hover .stage img { transform: translate(-6px, -6px); }
.project-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ==========================================================================
   Home
   ========================================================================== */

/* Faint dot grid, fading out toward the edges */
.dotted { position: relative; isolation: isolate; }
.dotted::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: var(--dots); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
}

.home-hero { padding: 96px 0 120px; text-align: center; }
.home-hero h1 { font-size: clamp(48px, 8vw, 96px); line-height: 1; font-weight: 300; margin-top: 16px; }
.home-hero .lede { font-size: clamp(19px, 2vw, 22px); line-height: 1.55; color: var(--ink-soft); max-width: 62ch; margin: 24px auto 0; text-wrap: balance; }
.home-work .projects { display: grid; gap: 32px; }

/* ==========================================================================
   About
   ========================================================================== */

.about-intro { padding-top: 72px; padding-bottom: 72px; }
.about-intro.has-photo { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; align-items: start; }
.about-intro p:not(.label) { max-width: var(--measure); margin: 0 0 20px; }
.about-intro h1 + p { font-size: clamp(24px, 3vw, 34px); line-height: 1.35; font-weight: 300; margin-top: 18px; margin-bottom: 32px; }
.about-photo { border-radius: 8px; box-shadow: var(--shadow-sm); }

.about-section { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 64px; row-gap: 16px; padding-top: 48px; padding-bottom: 72px; border-top: 1px solid var(--rule); }
.about-section > div > p { max-width: var(--measure); margin: 0 0 16px; }
.about-section .pull { margin: 0; }

.values { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.values li { background: var(--paper-2); border-radius: 8px; padding: 28px 28px 32px; }
.values h3 { font-size: 21px; line-height: 1.3; font-weight: 400; margin-bottom: 10px; }
.values p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-soft); }

.experience { list-style: none; margin: 0; padding: 0; }
.experience li { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 18px 0; border-top: 1px solid var(--rule); }
.experience li:first-child { border-top: 0; padding-top: 0; }
.experience b { font-weight: 500; }
.experience small { display: block; font-size: 15px; color: var(--ink-soft); margin-top: 2px; }

/* Outside of work: a mosaic of square cells */
.mosaic { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); aspect-ratio: 5 / 3; gap: 6px; margin-top: 24px; }
.mosaic figure { position: relative; margin: 0; overflow: hidden; background: var(--paper-2); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }

.about-contact h2 { font-size: clamp(32px, 4.4vw, 52px); line-height: 1.1; font-weight: 300; margin-bottom: 24px; }
.about-contact .links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 28px; }

/* ==========================================================================
   Case study
   ========================================================================== */

/* Hero: a band in the project's colour, like its home page card. Title on
   the left, intro on the right, then the screenshot at full width, whole,
   hanging below the band's edge. */
.project-card, .cs-hero { --ink-soft: var(--ink-soft-on-colour); }
.cs-hero { --hang: clamp(80px, 12vw, 180px); padding: clamp(48px, 7vw, 96px) 0 0; margin-bottom: 72px;
           background: linear-gradient(color-mix(in srgb, var(--c) 36%, var(--paper-2)) calc(100% - var(--hang)), transparent 0); }
.cs-hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px clamp(32px, 5vw, 72px); align-items: center; }
.cs-hero h1 { font-size: clamp(36px, 4vw, 56px); line-height: 1.04; font-weight: 300; margin: 16px 0 0; }
.cs-hero .lede { font-size: clamp(17px, 1.5vw, 19px); line-height: 1.6; color: var(--ink-soft); max-width: 46ch; margin: 0 0 24px; }
/* Tags on a project colour (card and hero) need a darker outline than on paper */
.project-card .tags li, .cs-hero .tags li { border-color: rgba(42, 39, 36, .2); }
.cs-hero-media { grid-column: 1 / -1; margin-top: clamp(24px, 4vw, 48px); }
.cs-hero-media img { width: 100%; border: 1px solid var(--edge); border-radius: 10px; box-shadow: var(--shadow); }

/* Final design slideshow (home card and case study hero): hovering a dot at
   the bottom fades to that screen. */
.slideshow { position: relative; touch-action: pan-y; }   /* sideways swipes change the screen */
/* The new screen fades in over the last one, which stays put underneath, so
   the fade never dips through to the background. */
.slideshow .slide { opacity: 0; z-index: 0; }
.slideshow .slide.was-current { opacity: 1; z-index: 1; }
.slideshow .slide.is-current { opacity: 1; z-index: 2; transition: opacity .45s ease, transform .4s var(--ease); }
.cs-hero-media .slides { display: grid; }
.cs-hero-media .slide { grid-area: 1 / 1; align-self: start; }
.dots { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: flex; gap: 2px;
        padding: 4px 6px; border-radius: 999px; background: rgba(42, 39, 36, .5); backdrop-filter: blur(6px); }
.dots > * { width: 7px; height: 7px; margin: 4px; border-radius: 50%; background: rgba(255, 255, 255, .45); transition: background .3s; }
.dots .on, .dots [aria-current="true"] { background: #fff; }
/* Dots get a bigger hover target than they show */
.dots > * { position: relative; cursor: pointer; }
.dots > *::after { content: ""; position: absolute; inset: -6px; }
.dots button { padding: 0; border: 0; }
.dots button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cs-hero-media .dots { bottom: 20px; }

.stage-panel { background: var(--paper-2); border-radius: 8px; padding: clamp(20px, 5vw, 64px); }
.stage-panel img { border: 1px solid var(--edge); border-radius: 6px; box-shadow: var(--shadow); margin: 0 auto; }

/* Summary: a full-width Results row, then the facts */
.cs-summary { padding-bottom: 40px; }
.metrics { list-style: none; margin: 14px 0 40px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.metrics li { display: grid; gap: 10px; align-content: start; }
.metrics b { font-weight: 300; font-size: 52px; line-height: 1; letter-spacing: -.02em; color: var(--accent-text); }
.metrics span { color: var(--ink-soft); font-size: 16px; line-height: 1.5; max-width: 30ch; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; margin: 0; padding: 32px 0 0; border-top: 1px solid var(--rule); }
.facts dt { margin-bottom: 10px; }
.facts dd { margin: 0; font-size: 15px; line-height: 1.55; }
.facts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

/* Body: sticky chapter index + reading column; figures break out to the right */
.cs-body { display: grid; grid-template-columns: 200px minmax(0, var(--measure)) minmax(0, 1fr); column-gap: 64px; border-top: 1px solid var(--rule); padding-top: 72px; }
.toc { grid-column: 1; grid-row: 1 / span 99; align-self: start; position: sticky; top: 32px; }
.toc ol { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: grid; grid-template-columns: 26px 1fr; padding: 6px 0; color: var(--ink-soft); text-decoration: none; font-size: 14px; line-height: 1.35; transition: color .2s; }
.toc a span { font: 500 11px/1.6 var(--font-mono); color: rgba(42,39,36,.3); transition: color .2s; }
.toc a:hover, .toc a.active { color: var(--ink); }
.toc a.active span { color: var(--accent-text); }

.chapter { grid-column: 2 / -1; display: grid; grid-template-columns: subgrid; padding-bottom: 88px; }
.chapter > * { grid-column: 1; }
.chapter .num { color: var(--accent-text); }
.chapter > h2:first-child { margin-top: 0; }
.chapter h2 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.15; font-weight: 400; margin: 14px 0 28px; }
.chapter h3.subhead { font-size: 23px; line-height: 1.3; margin: 44px 0 14px; }
.chapter h2 + h3.subhead { margin-top: 0; }
.chapter p { margin: 0 0 22px; }
.chapter strong { font-weight: 500; color: var(--ink); }

.chapter ul.points { list-style: none; margin: 4px 0 28px; padding: 0; }
.chapter ul.points li { position: relative; padding: 14px 0 14px 28px; border-top: 1px solid var(--rule); }
.chapter ul.points li:last-child { border-bottom: 1px solid var(--rule); }
.chapter ul.points li::before { content: ""; position: absolute; left: 2px; top: 25px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Before → after list (Final design) */
.chapter ul.shifts { list-style: none; margin: 4px 0 40px; padding: 0; }
.chapter ul.shifts li { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 18px 0; border-top: 1px solid var(--rule); }
.chapter ul.shifts li:last-child { border-bottom: 1px solid var(--rule); }
.chapter ul.shifts .was { color: var(--ink-soft); font-size: 16px; }
.chapter ul.shifts .now { position: relative; }
.chapter ul.shifts .now::before { content: "→"; position: absolute; left: -22px; color: var(--accent-text); }

/* Pull quotes */
.pull { margin: 12px 0 40px; padding: 4px 0 4px 26px; border-left: 2px solid var(--accent); }
.pull p { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.4; font-weight: 300; margin: 0 0 12px; }
.pull cite { font-style: normal; }
.pulls { display: grid; gap: 32px; margin: 12px 0 40px; }
.pulls .pull { margin: 0; }
.pulls .pull:nth-child(2) { border-color: var(--sage); }

/* The question each case study sets out to answer */
.question { background: color-mix(in srgb, var(--c) 36%, var(--paper-2)); border-radius: 8px; padding: 22px 26px 24px; margin: 8px 0 22px; }
.question .label { color: var(--ink-soft-on-colour); }
.chapter .question p { font-size: 21px; line-height: 1.4; margin: 8px 0 0; text-wrap: pretty; }

/* Figures */
figure { margin: 16px 0 48px; }
figcaption { margin-top: 12px; max-width: var(--measure); font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
/* Every figure and carousel spans the same width; captions stay at reading width */
.chapter figure, .chapter .fig-row { grid-column: 1 / -1; }
.fig-sheet img { background: #fff; border: 1px solid var(--edge); border-radius: 4px; box-shadow: var(--shadow-sm); }
.fig-screen .stage-panel { padding: clamp(16px, 4vw, 48px); }
.fig-board img { border-radius: 6px; }
.fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; margin: 16px 0 48px; }
.fig-row figure { margin: 0; }

/* Carousel: slides scroll sideways; caption and arrows sit underneath */
.carousel { margin: 16px 0 48px; }
.carousel-track { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 6px; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.carousel .slide { flex: 0 0 100%; scroll-snap-align: start; align-self: center; }
.carousel .slide img { width: 100%; }
.carousel-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.carousel-thumbs::-webkit-scrollbar { display: none; }
.carousel .thumb { flex: 0 0 96px; padding: 0; border: 1px solid var(--edge); border-radius: 4px; overflow: hidden; background: var(--paper-2); cursor: pointer; opacity: .55; transition: opacity .2s; }
.carousel .thumb img { width: 100%; aspect-ratio: 16 / 11; object-fit: cover; }
.carousel .thumb:hover { opacity: .85; }
.carousel .thumb[aria-current="true"] { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.carousel .thumb:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; opacity: 1; }
.carousel-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.carousel-bar figcaption { min-height: 3em; }
.carousel-nav { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex: none; }
.carousel-nav .count { margin-right: 6px; }
.carousel-nav button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule); background: none; color: var(--ink); font: 16px/1 var(--font-display); cursor: pointer; }
.carousel-nav button:hover:not(:disabled) { border-color: var(--ink); }
.carousel-nav button:disabled { opacity: .35; cursor: default; }

/* Reflection */
.chapter.reflection { grid-column: 2 / -1; background: var(--paper-2); border-radius: 8px; padding: clamp(28px, 5vw, 64px); margin-top: 8px; display: block; }
.chapter.reflection > * { max-width: var(--measure); }

/* Next project */
.cs-next { padding-top: 56px; }
.cs-next::before { content: ""; display: block; border-top: 1px solid var(--rule); margin-bottom: 56px; }
.cs-next a { color: var(--ink); text-decoration: none; display: inline-block; }
.cs-next h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 300; margin-top: 12px; }
.cs-next a:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; }

@media (max-width: 1100px) {
  .cs-body { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .chapter, .chapter.reflection { grid-column: 1; display: block; }
  .chapter > * { max-width: var(--measure); }
  .chapter figure, .chapter .fig-row { max-width: none; }
}
@media (max-width: 720px) {
  .cs-hero .wrap { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 1fr; min-height: 0; }
  .project-card .stage { height: 240px; }
  .project-card .stage img { left: 8%; top: 0; width: 130%; }
  .card-results { margin-top: 32px; }
  .home-hero { padding: 56px 0 80px; }
}
@media (max-width: 860px) {
  .about-intro.has-photo { grid-template-columns: 1fr; }
  .about-intro.has-photo .about-photo { max-width: 280px; grid-row: 1; }
  .about-section { grid-template-columns: 1fr; }
  .values { grid-template-columns: 1fr; }
  .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-flow: dense; aspect-ratio: auto; }
  .mosaic figure { grid-area: auto !important; aspect-ratio: 1; }
  .mosaic figure.wide { grid-column: span 2 !important; aspect-ratio: 2 / 1; }
  .facts { grid-template-columns: 1fr 1fr; }
  .fig-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .site-nav ul { gap: 16px; }
  .facts { grid-template-columns: 1fr; }
  .carousel .thumb { flex-basis: 64px; }
  .experience li { grid-template-columns: 1fr auto; gap: 4px 16px; }
  .experience li span { grid-column: 1 / -1; grid-row: 2; }
  .experience li .label { grid-column: 2; grid-row: 1; }
  .metrics { grid-template-columns: 1fr; gap: 24px; }
  .metrics b { font-size: 40px; }
  .chapter ul.shifts li { grid-template-columns: 1fr; gap: 6px; }
  .chapter ul.shifts .now { padding-left: 22px; }
  .chapter ul.shifts .now::before { left: 0; }
}

/* ==========================================================================
   Page transition: a project card grows into its case study hero (and back).
   Browsers without cross-document view transitions just load the page.
   ========================================================================== */

@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
