:root {
  color-scheme: light;
  --background: #eae8e5;
  --surface: #f0eeeb;
  --surface-hover: #e5e1dc;
  --text: #292326;
  --muted: #63595b;
  --accent: #aa4326;
  --accent-hover: #87331c;
  --rule: #cfcac5;
  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --body-font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display-font: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.23, 1, .32, 1);
  font-family: var(--body-font);
  background: var(--background);
  color: var(--text);
}

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

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

main { flex: 1; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
::selection { color: var(--background); background: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
main:focus { outline: none; }

.frame { width: min(calc(100% - 2 * var(--gutter)), 72rem); margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 5;
  top: 1rem;
  left: var(--gutter);
  padding: .65rem 1rem;
  color: var(--background);
  background: var(--text);
  transform: translateY(calc(-100% - 2rem));
}

.skip-link:focus { transform: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header { position: relative; z-index: 1; border-bottom: 1px solid var(--rule); }

.brand {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 3.125rem;
  padding: .65rem clamp(1rem, 2.5vw, 2rem);
  background: var(--accent);
  color: var(--background);
  font: 800 1.05rem / 1.15 var(--display-font);
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 180ms ease;
}

.brand:hover { background: var(--accent-hover); }
.brand:focus-visible { outline-color: var(--background); outline-offset: -5px; }

.pivot {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(1.1rem, 4vw, 3.75rem);
  padding-block-start: clamp(.25rem, 1.4vw, 1rem);
}

.pivot a {
  display: flex;
  position: relative;
  align-items: center;
  min-height: 2.75rem;
  padding-block: .35em .45em;
  color: var(--muted);
  font: 400 clamp(1.2rem, 4.2vw, 2.75rem) / 1.1 var(--display-font);
  letter-spacing: -.045em;
  text-decoration: none;
  transition: color 160ms ease;
}

.pivot a:hover, .pivot a[aria-current] { color: var(--text); }

.pivot a[aria-current]::after {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--accent);
  content: "";
}

.experience-nav { border-top: 1px solid var(--rule); }

.experience-nav-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(.9rem, 3vw, 2rem);
}

.experience-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: 650 .875rem / 1.2 var(--display-font);
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
}

.experience-nav a:is(:hover, :focus-visible) { border-color: var(--accent); color: var(--text); }

.hero {
  display: grid;
  grid-template-columns: 54% 46%;
  background: var(--background);
  border-bottom: 1px solid var(--rule);
}

.hero-visual {
  grid-area: 1 / 2;
  background: url("./escalier-corail.jpg") 72% center / cover no-repeat;
}

.hero-inner {
  grid-area: 1 / 1;
  width: auto;
  margin-inline: max(var(--gutter), calc((100vw - 72rem) / 2)) var(--gutter);
  padding-block: clamp(3.25rem, 6vw, 6rem) clamp(3.5rem, 5vw, 5rem);
}

.hero-kicker, .metadata {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .14em;
  line-height: 1.45;
  text-transform: uppercase;
}

.hero h1, .detail-heading h1, .section-heading h2 {
  font-family: var(--display-font);
  font-weight: 750;
  letter-spacing: -.072em;
}

.hero h1 {
  max-width: 14ch;
  margin-block-start: 1.15rem;
  font-size: clamp(2.7rem, 5.65vw, 5.9rem);
  letter-spacing: -.055em;
  line-height: 1;
  text-wrap: balance;
}

.section-heading h2 span { color: var(--accent); }

.hero-link, .text-link, .back-top {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  width: fit-content;
  min-height: 2.75rem;
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}

.hero-link {
  margin-top: 1.7rem;
  padding: .55rem .9rem;
  background: var(--accent);
  color: var(--background);
  transition: background-color 180ms ease;
}

.hero-link:focus-visible { outline-color: var(--text); }
.hero-link:hover { background: var(--accent-hover); }
.text-link, .back-top { color: var(--accent); }
.text-link:hover, .back-top:hover { text-decoration: underline; text-underline-offset: .22em; }

.home-section { padding-block: 3.6rem; }
.articles-section { border-top: 1px solid var(--rule); }

.section-heading { margin-bottom: 1.65rem; }
.section-heading h2 { font-size: clamp(2.8rem, 5.5vw, 4.55rem); line-height: 1; }

.section-title-link {
  display: inline-block;
  position: relative;
  cursor: pointer;
  text-decoration: none;
}

.section-title-link::after {
  position: absolute;
  inset: auto 0 -.12em;
  border-bottom: .045em solid var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms var(--ease);
}

.section-title-link:is(:hover, :focus-visible)::after { transform: scaleX(1); }

@media (forced-colors: none) {
  .section-title-link, .article-title {
    background: linear-gradient(to right, var(--accent) 50%, var(--text) 50%) right / 200% 100% no-repeat;
    background-clip: text;
    color: transparent;
    transition: background-position 320ms var(--ease);
  }

  .article-title { transition-duration: 600ms; }

  .section-title-link:is(:hover, :focus-visible),
  .article-row:focus-visible .article-title { background-position: left; }
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  list-style: none;
}

.project-card {
  display: block;
  height: 100%;
  text-decoration: none;
}

.project-card > .tilt-surface {
  display: flex;
  height: 100%;
  flex-direction: column;
  background: var(--surface);
  transition: background-color 200ms ease;
}

.tilt-surface { pointer-events: none; }

@media (prefers-reduced-motion: no-preference) {
  .tilt-link > .tilt-surface {
    transition: transform 240ms var(--ease), background-color 200ms ease;
  }

  .tilt-link[data-tilt] > .tilt-surface {
    --tilt-angle: 5deg;
    --tile-scale: 1;
    transform: perspective(900px)
      rotateY(calc(var(--tilt-x, 0) * var(--tilt-angle)))
      rotateX(calc(var(--tilt-y, 0) * var(--tilt-angle)))
      scale(var(--tile-scale));
    transition-duration: 90ms, 200ms;
  }

  .tilt-link:is(:active, [data-tilt="touch"]) > .tilt-surface {
    --tilt-angle: 11deg;
    --tile-scale: .985;
    transition-duration: 55ms, 200ms;
  }
}

.project-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 2.15;
  background: radial-gradient(ellipse at center, var(--surface), #dfd3cb 72%);
}

.project-logo {
  width: min(30%, 5.5rem);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.project-monogram {
  display: grid;
  place-items: center;
  border-radius: .75rem;
  background: var(--surface);
  color: var(--accent);
  font: 700 clamp(1.75rem, 5vw, 3rem) / 1 var(--display-font);
}

.project-copy { padding: 1.2rem 1.15rem 1.35rem; }
.project-copy .metadata { color: var(--muted); }
.project-copy h3 { margin-top: .32rem; font: 700 1.75rem / 1.12 var(--display-font); letter-spacing: -.04em; }
.project-description { margin-top: .6rem; color: var(--muted); font-size: .92rem; }
.back-top span {
  flex-shrink: 0;
  transition: transform 220ms var(--ease);
}

.back-top:hover span { transform: translate(2px, -2px); }

.article-list, .social-list, .topic-list, .timeline { list-style: none; }
.article-list, .topic-list, .timeline { border-top: 1px solid var(--rule); }
.article-list > li, .topic-list > li, .timeline > li { border-bottom: 1px solid var(--rule); }

.article-row {
  display: block;
  text-decoration: none;
  transition: background-color 180ms ease;
}

.article-row > .tilt-surface {
  display: grid;
  grid-template-columns: 10rem 1fr;
  align-items: center;
  gap: .75rem 1rem;
  min-height: 5rem;
  padding: 1rem .25rem;
}

@media (width > 42rem), (orientation: landscape) {
  .project-card:hover > .tilt-surface { background: var(--surface-hover); }
  .article-row:hover { background: var(--surface); }
  .article-row:hover .article-title { background-position: left; }
}

.article-row time { font-size: .82rem; color: var(--muted); }
.article-title { justify-self: start; font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 650; letter-spacing: -.025em; }
.empty-list { padding-block: 1rem; color: var(--muted); }

.landing-page, .detail-page { padding-block: clamp(3rem, 6vw, 6rem); }
.experience-page { padding-block-start: clamp(1.25rem, 3vw, 2rem); }
.page-heading, .detail-heading { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.page-lead { color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); }

.intro-quote {
  max-width: 52ch;
  margin: 0;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--accent);
  color: var(--muted);
  font: italic 400 clamp(1.125rem, 1rem + .6vw, 1.45rem) / 1.55 var(--body-font);
  text-wrap: pretty;
}

.experience-section + .experience-section { margin-top: 3.4rem; }
.experience-section > h2 { scroll-margin-block-start: 1rem; margin-bottom: 1.1rem; font-size: clamp(1.65rem, 3.3vw, 2.4rem); line-height: 1.1; letter-spacing: -.045em; }
.social-list { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.experience-page > .social-list { margin-bottom: 1.5rem; }

.social-item {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .5rem;
  border-radius: 2rem;
  background: var(--accent);
  color: var(--background);
  text-decoration: none;
}

.social-item svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.social-item:is(:hover, :focus-visible) { background: var(--accent-hover); }
.topic-list > li, .timeline > li { padding-block: 1rem; }
.topic-list h3, .timeline h3 { font-size: 1.19rem; }
.experience-org { margin-top: .25rem; color: var(--muted); }
.timeline > li { display: grid; grid-template-columns: minmax(7rem, 10rem) 1fr; gap: .45rem 1rem; }
.timeline .metadata { padding-top: .3rem; }
.experience-description, .experience-description > * + * { margin-top: .6rem; }
.experience-description ul, .experience-description ol { padding-inline-start: 1.35rem; }
.experience-description a { color: var(--accent); text-underline-offset: .2em; }

.detail-meta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .25rem 1rem; margin-bottom: .75rem; }

.detail-heading h1 { font-size: clamp(2.7rem, 6.4vw, 5.5rem); line-height: .98; overflow-wrap: anywhere; }
.detail-heading .page-lead { margin-top: 1.15rem; }
.article-banner {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 2;
  object-fit: cover;
  margin-top: 1.5rem;
}
.project-preview img { display: block; margin-inline: auto; }
.project-links { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; }
.article-body { font-size: 1.08rem; line-height: 1.75; overflow-wrap: anywhere; }
.detail-heading .page-lead, .article-body p, .article-body li { text-align: justify; hyphens: auto; }
.article-body > * + *, .article-body > [data-enter-block] > * + * { margin-top: 1.2rem; }
.article-body h2 { margin-top: 2rem; color: var(--text); font-size: 1.65rem; line-height: 1.2; }
.article-body a { color: var(--accent); text-underline-offset: .2em; }
.article-body img { max-width: 100%; height: auto; }
.article-body pre { overflow-x: auto; padding: 1rem; background: var(--surface); }
.article-body ul, .article-body ol { padding-left: 1.35rem; }

.article-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block-start: clamp(2rem, 5vw, 3.5rem);
}

.article-nav a {
  display: grid;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.article-nav .tilt-surface {
  padding: .85rem 1rem;
  border: 1px solid var(--rule);
  background: var(--surface);
}

.article-nav .metadata { display: block; margin-bottom: .25rem; }
.article-nav a[rel="next"] { grid-column: 2; text-align: end; }
.article-nav a:is(:hover, :focus-visible) > .tilt-surface { border-color: var(--accent); }

.site-footer { border-top: 1px solid var(--rule); }

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .25rem 1.5rem;
  min-height: 5.3rem;
  padding-block: .75rem;
}

.footer-name { font-weight: 650; }
.back-top { justify-self: end; }

@media (max-width: 48rem) {
  .home-section { padding-block: 2.7rem; }
}

@media (max-width: 42rem) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { grid-area: 2 / 1; aspect-ratio: 3.5; background-position: center 65%; }
  .hero-inner { padding-block: 2.9rem 2.5rem; }
}

@media (max-width: 42rem) and (orientation: portrait) {
  .brand {
    width: auto;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
  }

  .hero-visual { display: none; }
  .experience-nav-links { flex-direction: column; }
  .tilt-link, .section-title-link { -webkit-tap-highlight-color: transparent; }
  .tilt-link { touch-action: pan-y pinch-zoom; }
  .article-title { transition-duration: 150ms; }
  .article-row:is(:active, [data-tilt="touch"]) .article-title { background-position: left; }
}

@media (max-width: 35rem) {
  .pivot { column-gap: clamp(.75rem, 3.25vw, 1.1rem); }
  .pivot a { font-size: clamp(1rem, 4.2vw, 1.45rem); }
  .hero h1 { margin-block-start: .85rem; font-size: clamp(2.45rem, 8.5vw, 2.7rem); }
  .section-heading { margin-bottom: 1rem; }
  .article-row > .tilt-surface { grid-template-columns: 1fr; row-gap: .25rem; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav a[rel="next"] { grid-column: 1; }
  .timeline > li { grid-template-columns: 1fr; }
  .timeline .metadata { padding-top: 0; }
  .footer-inner { grid-template-columns: 1fr; justify-items: center; row-gap: .75rem; }
  .back-top { justify-self: center; }
}

@media screen and (prefers-reduced-motion: no-preference) {
  [data-social-reveal="pending"] > li:not(:focus-within) {
    opacity: 0;
    transform: translateY(1.25rem);
  }

  [data-social-reveal="visible"] > li:not(:focus-within) {
    transition: opacity 240ms ease-out, transform 460ms cubic-bezier(.22, 1.55, .36, 1);
    transition-delay: calc(var(--social-index) * 90ms);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(> .page-experiences) { scroll-behavior: smooth; }

  @view-transition { navigation: auto; }

  .site-header { view-transition-name: site-header; }
  ::view-transition-group(site-header) { animation-duration: 220ms; }
  ::view-transition-old(root) { animation: 150ms ease-in both page-out; }
  ::view-transition-new(root) { animation: 290ms var(--ease) both page-in; }

  @keyframes page-out { to { opacity: 0; transform: translateX(.5rem); } }
  @keyframes page-in { from { opacity: 0; transform: translateX(-.85rem); } }

  :root:active-view-transition-type(detail)::view-transition-old(root) { animation: 150ms ease-in both page-fade-out; }
  :root:active-view-transition-type(detail)::view-transition-new(root) { animation: 240ms ease-out both page-fade-in; }

  ::view-transition-group(detail-title) {
    z-index: 1;
    animation-duration: 340ms;
    animation-timing-function: var(--ease);
  }
  ::view-transition-old(detail-title) { animation: 120ms ease-in both page-fade-out; }
  ::view-transition-new(detail-title) { animation: 220ms 60ms ease-out both page-fade-in; }
  :root:active-view-transition-type(detail) :is(.project-copy h3, .detail-heading h1) { width: fit-content; }

  :root[data-page-enter], :root[data-page-exit] {
    overflow-x: clip;
    --slide-distance: clamp(2.5rem, 8vw, 7rem);
  }

  :root[data-page-enter="backward"], :root[data-page-exit="forward"] {
    --slide-offset: var(--slide-distance);
  }

  :root[data-page-enter="forward"], :root[data-page-exit="backward"] {
    --slide-offset: calc(-1 * var(--slide-distance));
  }

  [data-page-exit] .pivot a[aria-current]::after {
    transform-origin: left;
    transform: translate(var(--tab-x, 0px), var(--tab-y, 0px)) scaleX(var(--tab-scale, 1));
    transition: transform 160ms ease-in-out;
  }

  [data-page-enter]:not([data-page-enter="fade"]) [data-enter-block] {
    animation: 420ms var(--ease) backwards page-slide-in;
    animation-delay: calc(var(--enter-index, 0) * 160ms);
  }
  [data-page-exit] .experience-nav,
  [data-page-exit] body > :is(main, .site-footer) { animation: 180ms ease-in both page-slide-out; }

  [data-page-exit="fade"] body > :is(main, .site-footer) { animation: 150ms ease-in both page-fade-out; }
  [data-page-enter="fade"] body > :is(main, .site-footer) { animation: 240ms ease-out both page-fade-in; }

  @keyframes page-fade-in { from { opacity: 0; } }
  @keyframes page-fade-out { to { opacity: 0; } }
  @keyframes page-slide-in { from { opacity: 0; transform: translateX(var(--slide-offset)); } }
  @keyframes page-slide-out { to { opacity: 0; transform: translateX(var(--slide-offset)); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .back-top:hover span { transform: none; }
}
