/* THE OPEN — base.css
   Page defaults, typography roles, grid, focus, utilities. */

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: auto;
}

html[data-theme="bone"] {
  color-scheme: light;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(8, 7, 6, 0.08) 0 1px, transparent 1px 5px);
}

html[data-theme="bone"] body::before,
.tone-light body::before {
  opacity: 0.1;
}

main {
  display: block;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Typography roles ---------- */
/* DISPLAY — editorial serif: hero, chapter, statement, large question */
.t-mega,
.t-display,
.t-h1,
.t-h2,
.t-h3 {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: var(--track-caps);
  font-optical-sizing: auto;
}

.t-mega,
.t-display,
.t-h1,
.t-h2 {
  text-wrap: balance;
}

.t-mega { font-size: var(--fs-mega); line-height: var(--lh-display); }
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); }
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-display); }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-heading); font-weight: 350; }

.t-caps { text-transform: uppercase; }

/* Uppercase Vietnamese needs a touch more leading for stacked marks (Ể, Ữ, Ỗ) */
.t-caps.t-mega,
.t-caps.t-display,
.t-caps.t-h1 { line-height: 1.12; }

.t-lead {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  line-height: var(--lh-read);
  font-weight: 350;
}

.t-serif {
  font-family: var(--font-display);
  font-weight: 350;
}


/* SYSTEM — clean grotesk: navigation, buttons, metadata, forms, state */
.t-meta {
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
}

.t-small {
  font-size: var(--fs-small);
  line-height: 1.6;
}

.t-muted { color: var(--fg-2); }
.t-faint { color: var(--fg-3); }

p + p { margin-top: 1em; }

/* ---------- Links ---------- */
/* The underline is placed relative to the text, not the box, so it stays
   tight when the touch target grows to 44px. */
.link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding-block: 0.35em;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 calc(50% + 0.85em);
  background-repeat: no-repeat;
  transition: background-size var(--dur-hover) var(--ease-quiet), opacity var(--dur-hover) var(--ease-quiet);
}

.link:hover {
  background-size: 0% 1px;
  background-position: 100% calc(50% + 0.85em);
}

.link--quiet {
  background-size: 0% 1px;
  background-position: 100% calc(50% + 0.85em);
}

.link--quiet:hover {
  background-size: 100% 1px;
  background-position: 0 calc(50% + 0.85em);
}

.arrow {
  display: inline-block;
  transition: transform var(--dur-hover) var(--ease-quiet);
}

a:hover .arrow,
button:hover .arrow {
  transform: translateX(4px);
}

/* ---------- Focus ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

textarea:focus-visible,
input:focus-visible {
  outline-offset: 2px;
}

/* Headings and regions receive focus programmatically (so screen readers
   announce a new step); they are not controls, so they draw no ring. */
[tabindex="-1"]:focus {
  outline: none;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 999;
  padding: var(--s-3) var(--s-4);
  background: var(--fg);
  color: var(--bg);
  transform: translateY(-200%);
  transition: transform var(--dur-hover) var(--ease-quiet);
}

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

/* ---------- Grid ---------- */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


.sym {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.08em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  overflow: visible;
}

/* Founder color rule: black field, white text, red key actions. */
::selection {
  background: var(--signal);
  color: var(--bone);
}

.link,
.arrow {
  color: var(--signal-on-dark);
}

.tone-light .link,
[data-theme="bone"] .link {
  color: var(--signal-on-dark);
}

.t-faint {
  color: rgba(247, 243, 238, 0.42);
}

.t-muted {
  color: rgba(247, 243, 238, 0.68);
}
