/* ============================================================
   Letter — typography + layout + components
   ------------------------------------------------------------
   Personal-letter site styled as a piece of cardstock.
   Expects paper.css to be loaded first (sets --paper-* tokens).
   ============================================================ */

html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--paper-ink);
}

/* ---------- Page layout ---------- */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px 40px 160px;
  box-sizing: border-box;
  position: relative;
}

/* Wide-screen marginalia grid: gutter / body / gutter */
.page-grid {
  display: flex;
  flex-direction: column;
}
.letter-col { min-width: 0; }
.gutter { display: none; }
.polaroid-wrap { display: none; }
.polaroid-circle { display: block; }
.inline-case { 
  display: block; 
  width: 80%;
  margin: 0 auto;
}

/* ============================================================
   Case-study plate (used in marginalia gutters)
   ============================================================ */
.case-link {
  display: block;
  text-decoration: none;
  opacity: 0.9;
  color: var(--paper-ink);
  transition: opacity 160ms ease;
}
.case-link:hover { opacity: 1; }
.case-link:hover .plate { filter: brightness(0.98) saturate(1.05); }

.plate img { width: 100%; height: 100%; object-fit: cover; }
.plate-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(40,38,33,0.65);
  background: rgba(226,222,212,0.85);
  padding: 5px 9px;
  border: 1px solid rgba(40,38,33,0.20);
  text-align: center;
  line-height: 1.4;
}

.case {
  display: flex;
  flex-direction: column;
}
.case-cap {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.case-cap .eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-soft);
}
.case-cap .case-title {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 19px;
  line-height: 1.2;
}
.case-cap .case-title::after {
  content: "\00a0\2192";
  font-style: normal;
  color: var(--paper-soft);
}
.case-cap a {
  color: var(--paper-soft);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 120ms ease;
}
.case-cap  a:hover,
.case-cap  a.active { color: var(--paper-ink); }
.case-cap  a.active { border-bottom: 1px solid var(--paper-ink); }

/* ============================================================
   .color-reveal — desaturated at rest, ink-bleeds back to full
   color on hover. Drop on any <img> or background element.
   Works standalone OR when nested inside any <a> / .case-link.
   ============================================================ */
.color-reveal {
  filter: grayscale(1) contrast(0.95) sepia(0.08);
  transition: filter 480ms ease;
}
.color-reveal:hover,
a:hover .color-reveal,
.case-link:hover .color-reveal {
  filter: grayscale(0) contrast(1.05) sepia(0);
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-soft);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--paper-rule);
  margin-bottom: 56px;
}
.masthead nav { display: flex; gap: 22px; }
.masthead a {
  color: var(--paper-soft);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 120ms ease;
}
.masthead a:hover,
.masthead a.active { color: var(--paper-ink); }
.masthead a.active { border-bottom: 1px solid var(--paper-ink); }
.masthead .callout { display: none; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 96px;
  padding-top: 18px;
  border-top: 1px solid var(--paper-rule);
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-soft);
}
.footer .reply {
  color: var(--paper-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--paper-ink);
  padding-bottom: 2px;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.footer .reply:hover { opacity: 0.7; }

.footer nav { display: flex; gap: 22px; }
.footer a {
  color: var(--paper-soft);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 120ms ease;
}
.footer a:hover,
.footer a.active { color: var(--paper-ink); }
.footer a.active { border-bottom: 1px solid var(--paper-ink); }

/* ---------- Meta line ---------- */
.meta {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-soft);
  margin-bottom: 24px;
}

/* ---------- Headline ---------- */
.title {
  font-family: "DM Serif Display", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(44px, 6.0vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.018em;
  margin: 0 0 12px 0;
}
.title em { font-style: italic; font-weight: 400; }

.kicker {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 22px;
  color: var(--paper-soft);
  margin: 0 0 56px 0;
  line-height: 1.3;
}

/* ---------- Body type ---------- */
.letter { font-size: 18.5px; line-height: 1.62; }
.letter p { margin: 0 0 18px 0; text-wrap: pretty; hanging-punctuation: first; }
.letter .dear { font-style: italic; margin-bottom: 18px; }

/* Drop cap on the first paragraph */
.letter .first::first-letter {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 76px;
  line-height: 0.85;
  float: left;
  padding: 6px 12px 0 0;
  color: var(--paper-ink);
}

/* In-body headings — quiet section breaks within the letter */
.letter h2 {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 38px 0 14px 0;
}
.letter h2 .eyebrow {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--paper-soft);
  margin-bottom: 8px;
}
.letter h3 {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.005em;
  margin: 30px 0 10px 0;
}

/* Blockquote — pulled-in voice from elsewhere */
.letter blockquote {
  margin: 28px 0;
  padding: 4px 0 6px 26px;
  border-left: 2px solid var(--paper-rule);
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 22px;
  line-height: 1.32;
  letter-spacing: -0.005em;
  position: relative;
  text-wrap: balance;
}
.letter blockquote::before {
  content: "\201C";
  position: absolute;
  left: 4px;
  top: -22px;
  font-family: "DM Serif Display", serif;
  font-size: 64px;
  line-height: 1;
  color: var(--paper-rule);
  font-style: normal;
  opacity: 0.35;
  pointer-events: none;
}
.letter blockquote cite {
  display: block;
  margin-top: 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-soft);
}
.letter blockquote cite::before { content: "\2014\00a0\00a0"; }

/* Asides — small footnote-style notes set in monospace */
.aside {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--paper-soft);
  letter-spacing: 0.01em;
  padding: 12px 0 12px 14px;
  border-left: 1px solid var(--paper-rule);
  margin: 22px 0;
}

/* Horizontal rule, lightly */
.rule {
  border: none;
  height: 1px;
  background: var(--paper-rule);
  opacity: 0.6;
  margin: 36px 0 28px;
}

/* Decorative pilcrow scene break */
.break {
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  color: var(--paper-soft);
  font-size: 22px;
  margin: 32px 0;
  letter-spacing: 0.5em;
}

/* Signature */
.sign { font-style: italic; color: var(--paper-soft); margin: 28px 0 0 0; }
.signature {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 44px;
  line-height: 1;
  margin: 4px 0 0 0;
}
.ps { 
  font-family: "Caveat", cursive;
  color: var(--paper-ink);
  line-height: 1;
  margin-right: 8px;
}



/* ============================================================
   Polaroid (author portrait, pinned top-right)
   ============================================================ */
.polaroid-wrap {
  right: max(24px, calc(50vw - 552px));
  transform: rotate(-4deg);
  width: 240px;
  z-index: 4;
}
.polaroid {
  background: var(--paper-warm);
  padding: 10px 10px 36px;
  box-shadow: 0 16px 30px -14px rgba(20,18,15,0.35);
  position: relative;
  transition: transform 220ms ease, box-shadow 220ms ease;
}
.polaroid-wrap:hover .polaroid {
  transform: rotate(1deg) translateY(-2px);
  box-shadow: 0 20px 36px -14px rgba(20,18,15,0.38);
}
.polaroid-wrap:hover .polaroid img {
  transition: filter 120ms ease;
  filter: grayscale(0.1) sepia(0.1) contrast(1); 
}
.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1/1.1;
  object-fit: cover;
  filter: grayscale(0.6) sepia(0.3) contrast(0.85);  
}
.polaroid-wrap .tape {
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 78px; height: 22px;
  background: rgba(216, 195, 152, 0.55);
  border-left:  1px dashed rgba(40,38,33,0.10);
  border-right: 1px dashed rgba(40,38,33,0.10);
  box-shadow: 0 1px 2px rgba(20,18,15,0.05);
}
.polaroid .pcap {
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  text-align: center;
  font-family: "Caveat", cursive;
  font-size: 20px;
  color: var(--paper-ink);
  line-height: 1;
}
.polaroid-circle {
  max-width: 80px;
  margin: 0 auto;
}
.polaroid-circle .polaroid {
 padding: unset;
 border-radius: 50%;
 overflow: hidden;
}

/* Hero */
.caseStudy {
  max-width: 924px;
}
.caseStudy img {
  width: 100%;
  max-width: 800px;
}
.caseStudy .hero {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-top: 24px;
  padding-bottom: 24px;
  margin-top: 0px;
  margin-bottom: 24px;

  display: flex;
  flex-direction: column;
  align-items: center;
}
.caseStudy .hero.delivering {
  background-color: #00aaa7;
}
.caseStudy .hero.kounta {
  background-color: #F2EDEB;
}


.articles {
  display: grid;
  grid-template-rows: auto;
  grid-row-gap: 16px;
}

.articles img{
  max-height: 130px;
  object-fit: scale-down;
}

.masthead.case-study {
  margin-bottom: 0px;
  border-bottom: 0px;
}

@media screen and (min-width: 768px) {
  .articles {
    grid-template-columns: 1fr 1fr 1fr;
    grid-column-gap: 24px;
  }
}


/* Tablet & mobile — drop the polaroid into static flow */
@media (max-width: 1023px) {
  .polaroid-wrap {
    position: static;
    margin: 0 auto 36px;
    transform: rotate(-2deg);
    width: 160px;
  }
  .page { padding: 16px 24px 120px; }
}


@media (prefers-reduced-motion: reduce) {
  .color-reveal { transition: none; }
}

@media (min-width: 1024px) {
  .page-grid {
    display: grid;
    /* Defines 3 columns: sidebars take 1 part, center takes 2 parts of available space */
    grid-template-columns: 220px minmax(0, 600px) 220px;
    /* Defines 3 rows that adapt to the height of their content */
    grid-template-rows: auto auto auto; 
    
    /* The visual map matching your image */
    grid-template-areas: 
      "intro-left  intro  intro-right"
      "body-left   body   body-right"
      ".           footer .         ";
    column-gap: 60px;
    justify-content: center;
    align-items: start;
  }
  .page-grid.caseStudy {
    grid-template-columns: 1fr minmax(0, 924px) 1fr;
    margin: 0 auto;
  }
  .page-grid.caseStudy .details {
    grid-column: 2;
  }
  .page-grid.caseStudy img.small {
    width: auto;
  }
  .page-grid.caseStudy .centred {
    text-align: center;
    margin: 0 auto;
  }
  .page-grid.caseStudy .centred .meta {
    justify-content: center;
  }
  .caseStudy { grid-area: body;}

  .masthead .callout { display: block; }
  .polaroid-wrap { display: block; }
  .polaroid-circle { display: none; }
  .inline-case { display: none; }
  .gutter {
    display: flex;
    flex-direction: column;
    gap: 36px;
  }

  /* Assigning each HTML element to its respective grid area */
  .intro-left  { grid-area: intro-left; }
  .intro       { grid-area: intro; }
  .intro-right { grid-area: intro-right; }

  .case-study-left   { grid-area: body-left; }
  .case-study        { grid-area: body; }
  .case-study-right  { grid-area: body-right; padding-top: 500px; }

  .footer-body      { grid-area: footer; }
 
}
