/* ==========================================================
   Sky — portfolio
   Brand tokens come from the Sky design system.
   ========================================================== */

:root {
  --paper: #f7f3ec;
  --paper-raised: #fcfaf6;
  --fog: #e9e8e6;
  --ink: #1e1e1c;
  --ink-muted: #5e5a54;
  --hairline: #cfc8bd;
  --cobalt: #2f5bea;
  --cobalt-deep: #1c3fab;
  --card-ink: #1e1e1c;
  --focus: #1c3fab;

  --blush: #efc6c0;
  --peach: #f6d5ae;
  --butter: #efe39a;
  --sage: #cfe3d6;
  --powder: #cbe0ec;
  --lavender: #dcd3e8;

  --font-display: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --font-sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(20px, 8.33vw, 120px);
  --max: 1440px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-settle: cubic-bezier(.22, 1.35, .36, 1);

  color-scheme: light;
}

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

@property --peel {               /* size of the folder's peeled corner */
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--ink); }
a:hover { color: var(--cobalt); }

:where(a, button):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 999px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--paper); }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.mono-link {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

mark.hl {
  background: var(--hl, var(--sage));
  color: inherit;
  padding: 0 .08em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  transition: box-shadow .3s;
}
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--hairline); }

.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 88px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
}

.site-nav { display: flex; gap: 32px; }

.menu-toggle { display: none; }

/* ---------------- Hero ---------------- */

.stage { position: relative; isolation: isolate; }

.squiggle {
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
}
.squiggle path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero .wrap { padding-top: 72px; padding-bottom: 24px; }

.hero h1 {
  margin: 0;
  max-width: 1000px;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.6vw, 56px);
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--cobalt);
}

/* ---------------- At a glance (tags on lines) ---------------- */

.glance {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0;
  height: 250px;
}

.pair {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateY(-50%);
}
.pair:nth-child(1) { left: 33.47%; top: 40px; }
.pair:nth-child(2) { right: 8.13%; top: 98px; }
.pair:nth-child(3) { left: 11.8%; top: 156px; }
.pair:nth-child(4) { left: 46.87%; top: 214px; }

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: lowercase;
}
.tag-label {
  height: 48px;
  padding: 0 24px;
  background: var(--tag, var(--sage));
  border: 1px solid var(--card-ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--card-ink);
}
.tag-value {
  height: 38px;
  padding: 0 18px;
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
}
a.tag-value:hover { color: var(--cobalt); border-color: var(--cobalt); }

/* settle-in animation (classes toggled by main.js) */
.js-motion .settle {
  opacity: 0;
  translate: 40px 0;
}
.js-motion .settle.is-in {
  opacity: 1;
  translate: 0 0;
  transition: translate .9s var(--ease-settle), opacity .45s ease-out;
}

/* ---------------- Work / folders ---------------- */

.work .wrap { padding-top: 28px; padding-bottom: 96px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 24px;
  margin-bottom: 40px;
}
.section-head h2,
.about h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 34px;
  font-weight: 500;
}

.folders {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 24px;
  row-gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder {
  --c: var(--butter);
  --peel: 0px;
  transition: --peel .6s var(--ease-out);
  --back: color-mix(in srgb, var(--c) 86%, #1e1e1c);
  position: relative;
  display: flex;
  min-height: 208px;
  margin-top: 16px;
  color: var(--card-ink);
  text-decoration: none;
  perspective: 1100px;
}
.folder::before {               /* the tab, part of the back panel */
  content: "";
  position: absolute;
  left: 0;
  top: -16px;
  width: 164px;
  height: 17px;
  background: var(--back);
  border-radius: 2px 2px 0 0;
  clip-path: polygon(0 0, 84% 0, 100% 100%, 0 100%);
}
.folder-back {                  /* inside of the folder */
  position: absolute;
  inset: 0;
  background: var(--back);
  border-radius: 0 2px 2px 2px;
}
.folder-sheet {                 /* a page tucked inside */
  position: absolute;
  left: 14px;
  right: 22px;
  top: 10px;
  bottom: 12px;
  background:
    linear-gradient(var(--hairline), var(--hairline)) 18px 22px / 46% 1px no-repeat,
    linear-gradient(var(--hairline), var(--hairline)) 18px 34px / 62% 1px no-repeat,
    linear-gradient(var(--hairline), var(--hairline)) 18px 46px / 38% 1px no-repeat,
    var(--paper-raised);
  border-radius: 1px;
  transition: translate .5s var(--ease-out);
}
.folder-front {                 /* the cover; its top-left corner peels back */
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px 20px;
  background: var(--c);
  border-radius: 0 2px 2px 2px;
  clip-path: polygon(var(--peel) 0, 100% 0, 100% 100%, 0 100%, 0 var(--peel));
}
.folder-curl {                  /* underside of the peeled corner */
  position: absolute;
  left: 0;
  top: 0;
  width: var(--peel);
  height: var(--peel);
  pointer-events: none;
  filter: drop-shadow(1px 1.5px 1.5px rgba(30, 30, 28, .09));
}
.folder-curl::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  background: var(--paper-raised);
}
.folder:hover { color: var(--card-ink); }

.folder-meta {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.folder-arrow {
  font-family: var(--font-sans);
  font-size: 18px;
  letter-spacing: 0;
  transition: translate .45s var(--ease-out);
}
.folder-body { display: flex; flex-direction: column; gap: 12px; }
.folder-title {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 29px;
  font-weight: 500;
  max-width: 420px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--card-ink);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
}

/* Hover: the cover's top-left corner curls back like a page, so you can
   peek at the darker inside and the page tucked in it. */
@media (hover: hover) {
  .folder:hover,
  .folder:focus-visible { --peel: 78px; }
  .folder:hover .folder-sheet,
  .folder:focus-visible .folder-sheet { translate: 0 -8px; }
  .folder:hover .folder-arrow { translate: 6px 0; }
}
.folder:active { --peel: 48px; }

/* ---------------- About ---------------- */

.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--fog);
  max-width: var(--max);
  margin: 0 auto;
}
.about-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 96px 64px 96px var(--gutter);
}
.about-text p { margin: 0; font-size: 17px; line-height: 28px; max-width: 60ch; }
.about-text mark.hl { --hl: var(--butter); }
.about img {
  width: 100%;
  height: 100%;
  min-height: 460px;
  object-fit: cover;
  object-position: 54% 36%;
}

/* ---------------- Footer ---------------- */

.site-footer .wrap { padding-top: 80px; padding-bottom: 40px; }
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
}
.footer-top h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 52px;
  font-weight: 700;
  letter-spacing: -.015em;
}
.footer-links { display: flex; gap: 32px; flex-wrap: wrap; }
.footer-base {
  display: flex;
  justify-content: flex-end;
  margin-top: 80px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-muted);
}

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

.cs-hero {
  --c: var(--butter);
  max-width: var(--max);
  margin: 0 auto;
  background: var(--c);
  color: var(--card-ink);
  padding: 56px var(--gutter) 64px;
  position: relative;
}
.cs-back {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--card-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cs-hero h1 {
  margin: 48px 0 20px;
  max-width: 900px;
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.02em;
}
.cs-hero .chips .chip { height: 26px; font-size: 12px; padding: 0 12px; }
.cs-facts {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.cs-facts span {
  display: block;
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(30, 30, 28, .7);
}

.cs-body .wrap { padding-top: 80px; padding-bottom: 40px; }
.cs-section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  padding: 40px 0;
}
.cs-section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 28px;
  font-weight: 500;
}
.cs-section p { margin: 0 0 16px; max-width: 66ch; font-size: 17px; line-height: 28px; }
.placeholder { color: var(--ink-muted); }
.cs-figure {
  margin: 8px 0 0;
  aspect-ratio: 16 / 9;
  background: var(--fog);
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}

.cs-next .wrap { padding-top: 40px; padding-bottom: 96px; }
.cs-next .folder { max-width: 588px; }
.cs-next-label {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

/* ==========================================================
   Page transitions (cross-document View Transitions)
   ========================================================== */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition-old(root) { animation: vt-out .28s var(--ease-out) both; }
  ::view-transition-new(root) { animation: vt-in .45s var(--ease-out) both; }
  ::view-transition-group(folder-hero) { animation-duration: .55s; animation-timing-function: var(--ease-out); }

  @keyframes vt-out { to { opacity: 0; translate: 0 -12px; } }
  @keyframes vt-in { from { opacity: 0; translate: 0 16px; } }

  /* simple fade-in for browsers without view transitions */
  .no-vt body { animation: page-in .45s var(--ease-out) both; }
  @keyframes page-in { from { opacity: 0; } }
}

/* ==========================================================
   Tablet + mobile
   ========================================================== */

@media (max-width: 1099px) {
  .glance { height: auto; padding: 8px var(--gutter) 24px; }
  .pair {
    position: relative;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none;
    margin-bottom: 22px;
  }
  .pair:nth-child(even) { margin-left: auto; width: max-content; }
  .pair:nth-child(odd) { width: max-content; }
  .pair:last-child { margin-bottom: 0; }
}

@media (max-width: 820px) {
  .site-header .wrap { height: 68px; }
  .site-nav { display: none; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: var(--paper-raised);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
  }

  .hero .wrap { padding-top: 48px; padding-bottom: 20px; }
  .hero h1 { font-size: clamp(32px, 9vw, 40px); line-height: 1.3; }

  /* label + value stack into their own runs */
  /* every tag gets its own line, alternating left and right */
  .glance { padding-top: 12px; padding-left: 44px; padding-right: 44px; }
  .pair {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: 100% !important;
    margin-left: 0 !important;
    margin-bottom: 14px;
  }
  .pair .tag-label { align-self: flex-start; }
  .pair .tag-value { align-self: flex-start; }
  .tag-label { height: 44px; padding: 0 20px; font-size: 19px; }
  .tag-value { height: 36px; padding: 0 14px; font-size: 13px; max-width: 100%; }

  .work .wrap { padding-top: 40px; padding-bottom: 64px; }
  .section-head { margin-bottom: 20px; }

  /* swipeable folder rail */
  .folders {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    padding: 18px var(--gutter) 8px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .folders::-webkit-scrollbar { display: none; }
  .folders li { flex: 0 0 84%; scroll-snap-align: start; }
  .folder { min-height: 236px; height: 100%; }
  .folder-title { font-size: 22px; line-height: 27px; }

  .rail-dots { display: flex; gap: 6px; margin-top: 18px; }
  .rail-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--hairline);
    transition: width .3s var(--ease-out), background .3s;
  }
  .rail-dots span.is-on { width: 22px; background: var(--ink); }

  .about { grid-template-columns: 1fr; }
  .about img { order: -1; min-height: 0; aspect-ratio: 4 / 5; height: auto; }
  .about-text { padding: 40px var(--gutter) 56px; }

  .site-footer .wrap { padding-top: 64px; }
  .footer-top h2 { font-size: 40px; line-height: 44px; }
  .footer-links { flex-direction: column; gap: 10px; width: 100%; }
  .footer-links a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding: 0 20px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 18px;
    text-decoration: none;
    background: var(--paper-raised);
  }
  .footer-links a::after { content: "↗"; font-family: var(--font-sans); }
  .footer-base { margin-top: 48px; }

  .cs-hero { padding-top: 32px; }
  .cs-hero h1 { margin-top: 32px; }
  .cs-facts { gap: 24px; }
  .cs-section { grid-template-columns: 1fr; gap: 12px; padding: 28px 0; }
}

@media (min-width: 821px) { .rail-dots { display: none; } }

/* small phones: narrower side margins so long tag values fit on one line,
   and let them wrap inside the pill if the screen is narrower still */
@media (max-width: 400px) {
  .glance { padding-left: 30px; padding-right: 30px; }
  .tag-value {
    height: auto;
    min-height: 36px;
    padding-block: 8px;
    line-height: 18px;
    white-space: normal;
    text-wrap: balance;
    border-radius: 18px;
  }
}

/* ---------------- Mobile menu ---------------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 20px var(--gutter) 32px;
  background: var(--paper);
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s, visibility 0s .3s;
}
.menu.is-open { visibility: visible; opacity: 1; transition: opacity .3s; }
.menu-top { display: flex; justify-content: space-between; align-items: center; height: 48px; }
.menu-links { list-style: none; margin: 48px 0 0; padding: 0; }
.menu-links li { overflow: hidden; }
.menu-links a {
  display: block;
  padding: 10px 0;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
  color: var(--ink);
  translate: 0 105%;
  transition: translate .6s var(--ease-out);
}
.menu.is-open .menu-links a { translate: 0 0; }
.menu.is-open .menu-links li:nth-child(2) a { transition-delay: .05s; }
.menu.is-open .menu-links li:nth-child(3) a { transition-delay: .1s; }
.menu.is-open .menu-links li:nth-child(4) a { transition-delay: .15s; }
.menu.is-open .menu-links li:nth-child(5) a { transition-delay: .2s; }
.menu-foot { margin-top: auto; font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
body.menu-open { overflow: hidden; }

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js-motion .settle { opacity: 1; translate: 0 0; }
}
