/* simanotes.com — layout and components.
   ============================================================================
   Consumes the tokens in colors_and_type.css and introduces no raw color.
   The two structural devices below are the brand, expressed as layout, and are
   worth understanding before adding anything: docs/brand-design-brief.md §7.

     THE SLIP     Content sits in narrow bound columns. In the extension's side
                  panel there is literally one 400px slip; on the web a section
                  is three or four slips side by side. A slip is a column of a
                  bundle, not a card floating in space — hence flat, bordered,
                  never shadowed.

     THE CORD     A horizontal hairline that CROSSES several slips and visually
                  binds them into one document. It is the mark's cord, reused as
                  structure. Use it where the content below it is genuinely a
                  set. Do not use it as a divider between unrelated things —
                  that is what it means, and meaning it twice ruins it.

   Elevation is for transient things only (menus, toasts). Shadows on everything
   is the fastest way to look generic.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-heading);
  text-wrap: balance;
  margin: 0 0 var(--sp-4);
  letter-spacing: -0.011em;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 var(--sp-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--pine-deep); }

/* One focus style, everywhere, and it must survive on every ground. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--celadon); color: var(--ink-900); }

code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* Codes, figures and clocks must not jitter between values. */
.tabular, table { font-variant-numeric: tabular-nums; }

/* --- Skip link ------------------------------------------------------------ */

.skip {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--pine);
  border-radius: var(--r-sm);
  transform: translateY(-250%);
  transition: transform 120ms ease;
}
.skip:focus { transform: none; }

/* --- Page frame ----------------------------------------------------------- */

.wrap {
  width: min(100% - 2 * var(--sp-5), var(--page-max));
  margin-inline: auto;
}

main { display: block; }

section { padding-block: var(--sp-8); }
section.tight { padding-block: var(--sp-7); }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: var(--rule);
}

.site-header > .wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 4rem;
}

.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 1.6rem; width: auto; }
/* The reversed lockup swaps in for dark mode; only one is ever displayed. */
.brand .on-dark { display: none; }

.site-nav { margin-left: auto; }
.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--ink-700);
  text-decoration: none;
  font-size: var(--fs-sm);
  padding-block: var(--sp-2);
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink-900); }
/* Current page is marked by weight AND a rule, never by color alone. */
.site-nav a[aria-current='page'] {
  color: var(--ink-900);
  font-weight: 600;
  border-bottom-color: var(--cinnabar);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--ink-100);
  border-radius: var(--r-sm);
  color: var(--ink-900);
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

@media (max-width: 46rem) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    width: 100%;
    order: 3;
    border-top: var(--rule);
    padding-block: var(--sp-3);
  }
  .site-nav[data-open='true'] { display: block; }
  .site-nav ul { flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
  .site-nav a { display: block; width: 100%; font-size: var(--fs-base); }
  .site-header > .wrap { flex-wrap: wrap; }
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-primary { background: var(--pine); color: var(--on-fill); }
.btn-primary:hover { background: var(--pine-deep); color: var(--on-fill); }
.btn-secondary {
  background: transparent;
  color: var(--ink-900);
  border-color: var(--control-border);
}
.btn-secondary:hover { border-color: var(--ink-700); color: var(--ink-900); }

/* --- The cord ------------------------------------------------------------- */
/* A hairline that binds what follows into one set. The short cinnabar segment
   is the mark's single red slip, reduced to a tick — the one place red appears
   on this site as identity rather than state. */

.cord {
  position: relative;
  height: 1px;
  background: var(--ink-100);
  margin-block: var(--sp-7) var(--sp-6);
}
.cord::after {
  content: '';
  position: absolute;
  left: 0;
  top: -1px;
  width: 3rem;
  height: 3px;
  background: var(--cinnabar);
  border-radius: var(--r-pill);
}
.cord.centered::after { left: 50%; transform: translateX(-50%); }

/* An eyebrow label sitting on the cord. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0 0 var(--sp-3);
}

/* --- The bundle: slips side by side --------------------------------------- */

.bundle {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.bundle.of-2 { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

.slip {
  position: relative;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
  padding: var(--sp-5);
}
/* Card anatomy, one spec: a 3px status rail on the left, colored ONLY when the
   card carries state. An uncolored rail is the default and stays invisible. */
.slip::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: transparent;
}
.slip[data-state='accent']::before { background: var(--pine); }
.slip[data-state='record']::before { background: var(--cinnabar); }
.slip[data-state='note']::before { background: var(--indigo); }

.slip h3 { margin-bottom: var(--sp-2); }
.slip p { color: var(--ink-700); font-size: var(--fs-sm); }

/* A numbered slip, for ordered sequences (How it works). */
.slip .step {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-500);
  display: block;
  margin-bottom: var(--sp-3);
}

/* --- Prose ---------------------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose.wide { max-width: var(--measure-wide); }
.prose > * + h2 { margin-top: var(--sp-7); }
.prose > * + h3 { margin-top: var(--sp-6); }
.prose ul, .prose ol { padding-left: var(--sp-5); margin: 0 0 var(--sp-4); }
.prose li { margin-bottom: var(--sp-2); }
.prose li::marker { color: var(--ink-300); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.45;
  color: var(--ink-700);
  max-width: var(--measure-wide);
}

blockquote {
  margin: var(--sp-6) 0;
  padding-left: var(--sp-5);
  border-left: 2px solid var(--cinnabar);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-lead);
  color: var(--ink-700);
}
blockquote cite {
  display: block;
  margin-top: var(--sp-3);
  font: 500 var(--fs-xs) / 1.4 var(--font-mono);
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* --- Callouts ------------------------------------------------------------- */
/* Every callout carries a text label as well as its color, so no state on this
   site is signalled by color alone. */

.callout {
  border: 1px solid var(--indigo-line);
  background: var(--indigo-weak);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin-block: var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--ink-900);
}
.callout.warn { border-color: var(--amber-line); background: var(--amber-weak); }
.callout .label {
  display: block;
  font: 500 var(--fs-xs) / 1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-700);
  margin-bottom: var(--sp-2);
}

/* --- Tables --------------------------------------------------------------- */

.table-scroll { overflow-x: auto; margin-block: var(--sp-5); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
th, td {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--rule);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-500);
}

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

.hero { padding-block: var(--sp-9) var(--sp-8); }
.hero h1 {
  font-size: var(--fs-display);
  max-width: 18ch;
  margin-bottom: var(--sp-5);
}
.hero .lead { margin-bottom: var(--sp-6); }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* The boundary line: what this is not. Sits under the hero in mono, small, so
   it reads as a specification rather than a disclaimer. */
.boundary {
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
  border-top: var(--rule);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: var(--ink-500);
  max-width: var(--measure-wide);
}

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

.site-footer {
  border-top: var(--rule);
  margin-top: var(--sp-9);
  padding-block: var(--sp-7) var(--sp-6);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--ink-700);
}
.site-footer .cols {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin-bottom: var(--sp-6);
}
.site-footer h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--sp-3);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: var(--sp-2); }
.site-footer a { color: var(--ink-700); text-decoration: none; }
.site-footer a:hover { color: var(--ink-900); text-decoration: underline; }
.site-footer .fine {
  border-top: var(--rule);
  padding-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

/* --- Forms ---------------------------------------------------------------- */

.field { margin-bottom: var(--sp-5); }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
.field .hint {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-500);
  margin-bottom: var(--sp-2);
  font-weight: 400;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: var(--sp-3);
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--r-sm);
}
.field textarea { min-height: 8rem; resize: vertical; }

/* --- Field notes index ---------------------------------------------------- */

.note-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  transition: border-color 120ms ease;
}
.note-card:hover { border-color: var(--celadon-line); color: inherit; }
.note-card h3 { margin-bottom: var(--sp-2); font-size: var(--fs-h3); }
.note-card p { color: var(--ink-700); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.note-card .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-500);
  letter-spacing: 0.04em;
}

/* --- Motion --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand .on-light { display: none; }
  :root:not([data-theme='light']) .brand .on-dark { display: block; }
}
:root[data-theme='dark'] .brand .on-light { display: none; }
:root[data-theme='dark'] .brand .on-dark { display: block; }
:root[data-theme='light'] .brand .on-light { display: block; }
:root[data-theme='light'] .brand .on-dark { display: none; }

/* --- Print ---------------------------------------------------------------- */

@media print {
  .site-header, .site-footer, .skip, .actions { display: none; }
  /* The one deliberate raw-hex exception in this file. Paper is white and toner
     is black whatever theme the visitor is in, and a token would resolve to the
     dark palette for anyone printing in dark mode — a page of black ink. */
  body { background: #fff; color: #000; }
}
