/* base.css
 * Reset, editorial type scale, layout primitives, and components.
 * All visual values come from tokens.css. No raw hex or px values below
 * unless the design system specifies them literally.
 */

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

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

body,
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
  padding: 0;
}

ul[class], ol[class] { list-style: none; }

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

button, input, textarea, select { font: inherit; color: inherit; }

body {
  background: var(--canvas);
  color: var(--ink-body);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Section 7: a single fixed ambient layer. Never on a scrolling container. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient::before,
.ambient::after {
  content: '';
  position: absolute;
  opacity: var(--ambient-opacity);
}
.ambient::before {
  inset: -20% -10% auto -10%;
  height: 90vh;
  background: radial-gradient(65% 50% at 22% 10%, #D8C7A8 0%, #EADFCB 42%, transparent 72%);
  animation: drift-a 34s var(--ease-out) infinite alternate;
}
.ambient::after {
  inset: auto -20% -25% 40%;
  height: 80vh;
  background: radial-gradient(60% 50% at 78% 80%, #CFC4B2 0%, transparent 70%);
  animation: drift-b 42s var(--ease-out) infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(2%, 3%, 0); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-3%, -2%, 0); }
}

.shell {
  position: relative;
  z-index: 1;
}

/* --- Section 3: typography ------------------------------------------- */

.display,
.h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}

.display {
  font-size: clamp(2.875rem, 1.5rem + 6.2vw, 5.5rem);
}

.h2 {
  font-size: clamp(1.875rem, 1.25rem + 2.3vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.h3 {
  font-family: var(--font-sans);
  font-size: 1.1875rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.lede {
  font-size: clamp(1.1875rem, 1.0625rem + 0.45vw, 1.375rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: var(--measure-text);
  text-wrap: pretty;
}

.prose p {
  max-width: var(--measure-text);
  color: var(--ink-body);
  text-wrap: pretty;
}
.prose p + p { margin-top: 1.1em; }

.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); }

/* --- Section 8: macro whitespace and contained measure ---------------- */

.container {
  width: 100%;
  max-width: calc(var(--measure-wide) + 4rem);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 0.5rem + 3vw, 2.5rem);
}

.section { padding-block: var(--section-y); }

.section__head {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-bottom: clamp(2.5rem, 1.5rem + 4vw, 4rem);
}

.section__head .h2 { max-width: 24ch; }

/* --- Nav -------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(247, 246, 243, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  min-height: 3.5rem;
}

.nav__mark {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem clamp(1rem, 0.5rem + 1.5vw, 2rem);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}
.nav__links a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-hover) var(--ease-out);
}
.nav__links a:hover { color: var(--ink); }

@media (max-width: 34rem) {
  .nav__links a[data-optional] { display: none; }
}

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

.hero {
  padding-block: clamp(4rem, 2rem + 9vw, 7.5rem) clamp(4rem, 2rem + 8vw, 7rem);
}

.hero__mark {
  display: block;
  margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.hero__headline { max-width: 18ch; }

.hero__lede {
  margin-top: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  max-width: 40rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: clamp(2rem, 1.5rem + 2vw, 2.75rem);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* --- Section 5: buttons ----------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: var(--canvas-pure);
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  padding: var(--pad-control);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background var(--dur-hover) var(--ease-out),
              border-color var(--dur-hover) var(--ease-out),
              transform var(--dur-hover) var(--ease-out);
}
.btn:hover {
  background: #333333;
  border-color: #333333;
}
.btn:active { transform: scale(0.98); }

.btn--quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn--quiet:hover {
  background: var(--surface);
  border-color: var(--ink-muted);
}

.link-mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color var(--dur-hover) var(--ease-out),
              border-color var(--dur-hover) var(--ease-out);
}
.link-mono:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* --- Section 5: bento feature grid ------------------------------------ */

/* Uniform grid. An asymmetric bento was tried first and read as scattered
 * once the body copy grew, so every card now gets the same column span. */
.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 0.4rem + 1vw, 1.25rem);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--pad-card);
  box-shadow: var(--shadow-rest);
  transition: box-shadow var(--dur-hover) var(--ease-out),
              border-color var(--dur-hover) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}

.card__kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.card__body {
  color: var(--ink-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 44ch;
  text-wrap: pretty;
}

@media (max-width: 64rem) {
  .bento { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 40rem) {
  .bento { grid-template-columns: 1fr; }
  /* The file listing wraps its notes onto a second line; keep that note
   * flush left under the filename instead of right-aligned. */
  .tree__note { margin-left: 0; }
}

/* --- Section 5: tags and status badges -------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag--blue   { background: var(--pastel-blue-bg);   color: var(--pastel-blue-fg); }
.tag--green  { background: var(--pastel-green-bg);  color: var(--pastel-green-fg); }
.tag--yellow { background: var(--pastel-yellow-bg); color: var(--pastel-yellow-fg); }
.tag--red    { background: var(--pastel-red-bg);    color: var(--pastel-red-fg); }
.tag--plain  { background: var(--surface-alt);      color: var(--ink-muted); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.status::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--pastel-green-fg);
}

/* Secondary meta item in the hero row. Same scale as .status, quieter mark. */
.meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.meta__dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--ink-muted);
}

/* --- Open to list ------------------------------------------------------ */

.opento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(0.75rem, 0.4rem + 1vw, 1.25rem);
}
.opento__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--pad-card);
  transition: box-shadow var(--dur-hover) var(--ease-out);
}
.opento__item:hover { box-shadow: var(--shadow-hover); }
.opento__note {
  font-size: 1.0625rem;
  color: var(--ink-body);
  text-wrap: pretty;
}

/* --- Section 5: borderless accordion ----------------------------------- */

.accordion { border-top: 1px solid var(--border); }

.accordion__item { border-bottom: 1px solid var(--border); }

.accordion__trigger {
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 0.5rem + 2vw, 2.5rem);
  padding-block: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  transition: color var(--dur-hover) var(--ease-out);
}
.accordion__trigger::-webkit-details-marker { display: none; }
.accordion__trigger:hover { color: var(--ink-muted); }

.accordion__index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  flex: none;
}

.accordion__question {
  font-size: clamp(1.1875rem, 1.0625rem + 0.55vw, 1.4375rem);
  letter-spacing: -0.01em;
  font-weight: 500;
  line-height: 1.35;
  flex: 1;
}

/* Sharp plus / minus, drawn with two bars. */
.accordion__sign {
  position: relative;
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
  align-self: center;
}
.accordion__sign::before,
.accordion__sign::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1.5px;
  background: var(--ink);
}
.accordion__sign::after { transform: rotate(90deg); }
.accordion__trigger[aria-expanded='true'] .accordion__sign::after,
.accordion__item[open] .accordion__sign::after { transform: rotate(0deg); }

.accordion__answer {
  padding-bottom: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  padding-right: clamp(0rem, -1rem + 8vw, 4rem);
  max-width: 58ch;
  color: var(--ink-body);
  text-wrap: pretty;
}

/* --- Section 5: faux-OS window chrome ---------------------------------- */

.window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.window__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  background: var(--canvas-pure);
  border-bottom: 1px solid var(--border);
}
.window__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--border);
}
.window__title {
  margin-left: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.tree {
  padding: clamp(1rem, 0.5rem + 1.5vw, 1.5rem);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 2;
}
.tree__row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0.75rem;
  padding-left: calc(var(--depth, 0) * 1.1rem);
  border-left: 1px solid var(--border-soft);
  margin-left: 0.25rem;
}
.tree__row--dir { color: var(--ink); }
.tree__row--file { color: var(--ink-body); }
.tree__row--file > span:first-child::before { content: '— '; color: var(--ink-muted); }
.tree__note {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  text-align: right;
}

.window__caption {
  padding: 0 clamp(1rem, 0.5rem + 1.5vw, 1.5rem) clamp(1rem, 0.5rem + 1.5vw, 1.5rem);
  font-size: 0.9375rem;
  color: var(--ink-muted);
  max-width: 54ch;
  text-wrap: pretty;
}

.hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Section 5: keystroke micro-UI. */
kbd {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  padding: 0.1rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-body);
}

/* --- Contact ----------------------------------------------------------- */

.contact {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: clamp(2rem, 1.25rem + 3vw, 3.5rem);
}
.contact__email {
  display: inline-block;
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: clamp(1.0625rem, 0.9rem + 1vw, 1.375rem);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
  word-break: break-all;
  transition: border-color var(--dur-hover) var(--ease-out);
}
.contact__email:hover { border-color: var(--ink); }

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2rem;
}

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

.footer {
  border-top: 1px solid var(--border);
  padding-block: clamp(2.5rem, 2rem + 2vw, 3.5rem);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* --- Alignment: centred composition -----------------------------------
 * Everything textual is centred on the measure. Section 8 caps the measure
 * at max-w-4xl/5xl; centring reads badly at that width, so the values here
 * sit below that ceiling deliberately.
 *
 * Three things stay left-aligned, each on purpose:
 *   1. The principles accordion, because centring the questions and answers
 *      reads badly. Per the owner, 2026-09-27.
 *   2. The monospace file tree in the faux-OS window, because a listing with
 *      a right-hand notes column is semantically aligned.
 *   3. The window title bar, for the same reason.
 */

body { text-align: center; }

.lede,
.prose p,
.section__head .h2,
.window__caption {
  margin-inline: auto;
}

.lede { max-width: 34rem; }
.prose p { max-width: 36rem; }

.section__head { align-items: center; }

.nav__inner,
.hero__meta,
.hero__actions,
.contact__actions,
.hint,
.window__bar,
.footer__inner {
  justify-content: center;
}

.nav__inner { gap: clamp(1.25rem, 0.5rem + 2.5vw, 2.5rem); }

.card,
.opento__item { align-items: center; }

.card__body { max-width: 34ch; }

/* Exception 1: the accordion keeps its left-aligned, hanging-indent layout. */
.accordion { text-align: left; }
.accordion__trigger {
  justify-content: flex-start;
  gap: clamp(1rem, 0.5rem + 2vw, 2.5rem);
}
.accordion__question { flex: 1; }
.accordion__answer {
  text-align: left;
  max-width: 58ch;
  margin-inline: 0;
  padding-right: clamp(0rem, -1rem + 8vw, 4rem);
}

/* Exceptions 2 and 3: the file listing and its title bar. */
.tree,
.tree__row,
.window__title { text-align: left; }

/* --- Section 7: scroll entry ------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(12px);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
  transition-delay: calc(var(--index, 0) * var(--stagger-step));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ambient::before,
  .ambient::after { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
