:root {
  --paper: #f5f2eb;
  --paper-deep: #e9e4d9;
  --ink: #232b24;
  --green: #344536;
  --green-deep: #233229;
  --green-soft: #52634e;
  --lime: #e8dc94;
  --lime-soft: #e8e1b4;
  --line: #bebdb0;
  --muted: #58645a;
  --type-display: clamp(2.8rem, 4.6vw, 4.75rem);
  --type-section: clamp(2.15rem, 3.5vw, 3.65rem);
  --type-card: clamp(1.15rem, 1.55vw, 1.45rem);
  --display: "Unbounded", sans-serif;
  --body: "Manrope", sans-serif;
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --section: clamp(5rem, 10vw, 9rem);
  --content: 96rem;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 1rem; line-height: 1.6; text-rendering: optimizeLegibility; }
body, button, input, textarea, select { font-family: var(--body); }
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .24em; text-decoration-thickness: .08em; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; }
::selection { color: var(--green-deep); background: var(--lime); }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper-deep); }
::-webkit-scrollbar-thumb { background: var(--green-soft); border: 3px solid var(--paper-deep); }

.skip-link { position: fixed; z-index: 20; top: .75rem; left: .75rem; padding: .75rem 1rem; background: var(--lime); color: var(--green-deep); transform: translateY(-150%); visibility: hidden; transition: transform .2s var(--ease); }
.skip-link:focus { transform: translateY(0); visibility: visible; }

.back-to-top { position: fixed; z-index: 15; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); min-height: 3.25rem; padding: .6rem 1rem; display: inline-flex; align-items: center; gap: .65rem; border: 1px solid var(--green-deep); background: var(--lime); color: var(--green-deep); box-shadow: 0 .35rem 1.2rem rgb(0 0 0 / .22); font-size: .8rem; font-weight: 700; line-height: 1; text-decoration: none; }
.back-to-top[hidden] { display: none; }
.back-to-top:hover { background: var(--paper); }
.back-to-top-icon { font-size: 1.5rem; font-weight: 500; line-height: 1; }

a, button { transition: color .22s var(--ease), background-color .22s var(--ease), border-color .22s var(--ease), transform .22s var(--ease); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--lime); outline-offset: 4px; }
a:active, button:active { transform: translateY(1px); }

.site-header { min-height: 5.5rem; padding: 0 var(--gutter); display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: clamp(1rem, 2.5vw, 2.5rem); border-bottom: 1px solid var(--line); background: var(--paper); position: relative; z-index: 10; }
.identity { display: flex; align-items: baseline; gap: .85rem; text-decoration: none; }
.identity span { font: 800 1.5rem/1 var(--display); letter-spacing: -.03em; }
.identity small { color: var(--muted); font-size: .8rem; letter-spacing: .06em; }
.site-header nav { display: flex; justify-content: flex-end; gap: clamp(1rem, 2.5vw, 2.25rem); }
.site-header nav a, .lang { font-size: .8rem; font-weight: 700; text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
.lang { width: 3rem; height: 3rem; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.lang:hover { background: var(--paper-deep); }
.header-action { min-height: 3rem; display: inline-flex; align-items: center; padding: 0 1.1rem; background: var(--green); color: white; text-decoration: none; font-size: .8rem; font-weight: 700; }
.header-action:hover { background: var(--green-soft); }

.section { padding: var(--section) max(var(--gutter), calc((100vw - var(--content)) / 2)); scroll-margin-top: 0; }
.section-title { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(18rem, .55fr); align-items: end; gap: clamp(2rem, 7vw, 8rem); margin-bottom: clamp(3.5rem, 7vw, 6rem); }
.section-title > * { min-width: 0; overflow-wrap: anywhere; }
.section-title.compact { margin-bottom: 3rem; }
.section-title h2 { max-width: 20ch; font: 700 var(--type-section)/1.1 var(--display); letter-spacing: -.03em; text-wrap: balance; }
.section-title p { max-width: 37rem; color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.55; text-wrap: pretty; }
.section-title.inverse p { color: #d2d7c6; }

.button { min-height: 3.65rem; display: inline-flex; align-items: center; justify-content: center; padding: .85rem 1.35rem; border: 1px solid transparent; text-decoration: none; font-weight: 700; }
.button-primary { background: var(--lime); color: var(--green-deep); }
.button-primary:hover { background: white; }
.button-dark { background: var(--green-deep); color: white; }
.button-dark:hover { background: var(--green-soft); }
.text-action { font-weight: 700; }

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto 1fr auto auto; }
  .site-header nav { display: flex; }
  .site-header nav a:not([href="work.html"]) { display: none; }
  .header-action { justify-self: end; }
  .section-title { grid-template-columns: 1fr; gap: 1.75rem; }
}

@media (max-width: 680px) {
  .back-to-top { right: 0; width: 2.75rem; height: 2.75rem; min-height: 2.75rem; padding: 0; justify-content: center; border-right: 0; border-radius: .5rem 0 0 .5rem; }
  .back-to-top-text { display: none; }
  .site-header { min-height: 4.75rem; gap: .65rem; }
  .site-header nav a { font-size: .8rem; }
  .identity small { display: none; }
  .lang { width: 2.75rem; height: 2.75rem; border: 0; }
  .header-action { min-height: 2.75rem; padding: 0 .8rem; font-size: .8rem; }
  .section { padding-top: 4.5rem; padding-bottom: 4.75rem; }
  .section-title h2 { font-size: var(--type-section); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a, button, .skip-link { transition: none !important; }
  .workflow-panel.is-entering { animation: none !important; }
}
