/* tord.dev — Plain system sans for the page; mono only for code.
 * Cards and tiles have full-ink 1.5px borders.
 * Cards lift on hover with a hard accent shadow rather than flipping color.
 * One cobalt accent: dot in the wordmark, submit button, focus ring,
 * tile mark, hover shadow, and focus states.
 */

/* ============================ Tokens ============================ */

:root {
  color-scheme: light;
  --paper:       #f4f6fa;
  --ink:         #14171c;
  --bg-code:     #e6eaf2;
  --rule-soft:   #d4dae5;
  --text-muted:  #545a66;
  --text-subtle: #868c98;
  --accent:      #1f4fff;
  --accent-text: #f4f6fa;
  --danger:      #d41a2b;

  --sans:  -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "JetBrains Mono", monospace;

  --content: 960px;
  --reading: 700px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:       #0f1218;
  --ink:         #e6e9f0;
  --bg-code:     #1a1d24;
  --rule-soft:   #262a33;
  --text-muted:  #9ea2ad;
  --text-subtle: #686c75;
  --accent:      #6e8dff;
  --accent-text: #0f1218;
  --danger:      #ff6373;
}

/* ============================ Reset ============================ */

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
}

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

/* ============================ Wordmark + chrome ============================ */

.wordmark {
  position: absolute;
  top: 1.85rem;
  left: clamp(1.4rem, 3vw, 2rem);
  z-index: 5;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  transition: opacity 150ms ease;
}
.wordmark .dot { color: var(--accent); }
.wordmark:hover,
.wordmark:focus-visible { opacity: 0.7; outline: none; }

.theme-toggle {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  z-index: 5;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--rule-soft);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.theme-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================ Wrap ============================ */

.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: clamp(5.5rem, 8vw, 7rem) clamp(1.4rem, 4vw, 3rem) 4rem;
  position: relative;
}

.prose { position: relative; }

/* ============================ Section labels ============================ */

.section-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 0 1.5rem;
}
.section-label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-soft);
}

/* ============================ Bio (index) ============================ */

.bio {
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 56ch;
  margin: 0 0 4rem;
  color: var(--ink);
}
.bio a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: currentColor;
  transition: text-decoration-thickness 120ms ease;
}
.bio a:hover { text-decoration-thickness: 2px; }

/* ============================ Posts list ============================ */

.posts {
  list-style: none;
  display: grid;
  gap: 1.25rem;
  margin: 0 0 5rem;
}

.post-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  border: 1.5px solid var(--ink);
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.post-link:hover,
.post-link:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 0 var(--accent);
  outline: none;
}

.post-date {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1;
  padding: 1.35rem 1.55rem;
  border-right: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: var(--text-muted);
}

.post-body-side {
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-title {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  color: var(--ink);
}

.post-excerpt {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 720px) {
  .post-link { grid-template-columns: 1fr; }
  .post-date {
    border-right: 0;
    border-bottom: 1.5px solid var(--ink);
  }
}

/* ============================ Subscribe ============================ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.subscribe {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-soft);
  max-width: var(--reading);
}

.subscribe .section-label {
  margin: 0 0 0.7rem;
}

.subscribe-blurb {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
  max-width: 52ch;
}

.subscribe-form {
  width: 100%;
  max-width: 520px;
  margin-top: 0;
}

.subscribe-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 0.55rem 0.8rem;
  outline: none;
  border-radius: 0;
  transition: box-shadow 150ms ease;
}
.subscribe-form input[type="email"]:focus {
  box-shadow: 0 0 0 3px var(--accent);
}
.subscribe-form input[type="email"]::placeholder {
  color: var(--text-subtle);
}

.subscribe-form button[type="submit"] {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 1.5px solid var(--ink);
  border-left: 0;
  border-radius: 0;
  padding: 0 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.subscribe-form button[type="submit"]:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 0 var(--ink);
}
.subscribe-form button[type="submit"]:focus-visible {
  outline: none;
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 0 var(--ink);
}
.subscribe-form button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.subscribe-status {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.55rem;
  min-height: 1.1em;
  color: var(--text-muted);
}
.subscribe-status[data-state="success"] { color: var(--ink); }
.subscribe-status[data-state="error"]   { color: var(--danger); }

@media (max-width: 540px) {
  .subscribe-row { flex-direction: column; }
  .subscribe-form button[type="submit"] {
    border-left: 2px solid var(--ink);
    border-top: 0;
    padding: 0.85rem 1.4rem;
  }
}

/* ============================ Post page ============================ */

.post-header {
  position: relative;
  margin-bottom: 3.5rem;
}

.back {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 150ms ease;
}
.back::before { content: "← "; color: var(--text-subtle); }
.back:hover { color: var(--ink); }
.back:hover::before { color: var(--ink); }

.post-meta {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}
.post-meta .dot {
  width: 3px; height: 3px;
  background: var(--text-subtle);
  display: inline-block;
  border-radius: 50%;
}

.post-header h1 {
  font-family: var(--sans);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.026em;
  font-weight: 600;
  color: var(--ink);
  max-width: 28ch;
}

/* ============================ Article body ============================ */

.article {
  font-family: var(--sans);
  font-size: clamp(1.03rem, 1vw + 0.82rem, 1.12rem);
  line-height: 1.72;
  color: var(--ink);
  max-width: 66ch;
}

.article p { margin-bottom: 1.2rem; }

.article strong { font-weight: 600; color: var(--ink); }

.article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: currentColor;
  transition: text-decoration-thickness 120ms ease;
}
.article a:hover {
  text-decoration-thickness: 2px;
}

.article h2 {
  font-family: var(--sans);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.016em;
  line-height: 1.25;
  color: var(--ink);
  margin: 3rem 0 1rem;
}

.article h3 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 2rem 0 0.65rem;
}

.article ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0 0 1.35rem;
}
.article ul li {
  margin-bottom: 0.3rem;
  padding-left: 0.25rem;
}
.article ul li::marker { color: var(--text-subtle); }

/* Inline code — subtle, calm */
.article code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-code);
  color: var(--ink);
  padding: 0.1em 0.4em;
  border-radius: 2px;
}

/* Code blocks — subtle bg, accent language tag */
.article pre {
  position: relative;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  background: var(--bg-code);
  padding: 1.5rem 1.75rem;
  margin: 2.25rem 0;
  overflow-x: auto;
  border-radius: 3px;
}
.article pre code {
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: inherit;
}
.article pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.55rem;
  right: 3.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.code-copy {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  background: var(--bg-code);
  border: 0;
  padding: 0.3rem 0.55rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-subtle);
  cursor: pointer;
  user-select: none;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease;
}
.article pre:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--ink); }
.code-copy[data-state="copied"] { opacity: 1; color: var(--ink); }
.code-copy:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
@media (hover: none) {
  .code-copy { opacity: 0.55; }
}

.article hr {
  border: 0;
  height: 1px;
  background: var(--rule-soft);
  margin: 3.25rem 0;
}

/* Architecture diagrams */
.article figure.diagram {
  margin: 2.75rem 0;
}
.architecture {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
}
.architecture text {
  fill: currentColor;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}
.architecture .section-label {
  fill: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.architecture .note {
  fill: var(--text-muted);
  font-size: 10.5px;
  font-style: normal;
}
.architecture .bypass {
  fill: var(--danger);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.article figure.diagram figcaption {
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 0.85rem;
  font-style: italic;
}
.article figure.diagram figcaption em { font-style: italic; }

/* Generic figures */
.article figure { margin: 2.25rem 0; }
.article figure img {
  width: 100%;
  display: block;
  border-radius: 3px;
}
.article figcaption {
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 0.7rem;
  font-style: italic;
}

.img-placeholder {
  aspect-ratio: 16 / 6.5;
  background: var(--bg-code);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-subtle);
  border-radius: 3px;
}

/* Post footer (small one on post pages) */
.post-footer {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
}
.post-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 150ms ease;
}
.post-footer a:hover { color: var(--ink); }

/* ============================ Site footer ============================ */

.site-footer {
  margin: 5rem auto 0;
  max-width: var(--content);
  padding: 2rem clamp(1.4rem, 4vw, 3rem);
  border-top: 1px solid var(--rule-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 150ms ease;
}
.site-footer a:hover { color: var(--ink); }

/* ============================ Mobile chrome ============================ */

@media (max-width: 640px) {
  .wrap { padding: 6rem 1.4rem 3rem; }
  .wordmark { top: 1.5rem; left: 1.4rem; }
  .theme-toggle {
    top: 1.1rem; right: 1.15rem;
    width: 2rem; height: 2rem;
  }
  .article pre {
    padding: 1.25rem 1.1rem;
    font-size: 0.76rem;
    border-radius: 0;
    margin-left: -1.4rem;
    margin-right: -1.4rem;
  }
  .post-meta { flex-wrap: wrap; }
}

/* ============================ Config builder ============================ */

.config-builder {
  display: grid;
  gap: 1rem;
  margin: 2rem 0 1.5rem;
  font-family: var(--mono);
}

.config-builder fieldset {
  border: 1px solid var(--rule-soft);
  padding: 0.85rem 1rem 1rem;
  margin: 0;
  border-radius: 0;
  min-width: 0;
}

.config-builder legend {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0 0.5rem;
}

.config-builder label {
  display: block;
  margin: 0.55rem 0;
  font-size: 0.92rem;
  font-family: var(--sans);
  font-weight: 400;
}

.config-builder hr {
  border: 0;
  border-top: 1px solid var(--rule-soft);
  margin: 0.85rem 0;
}

.config-builder input[type="text"],
.config-builder input[type="email"],
.config-builder input[type="number"],
.config-builder textarea {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  padding: 0.4rem 0.55rem;
  border-radius: 0;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.config-builder input:focus,
.config-builder textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent);
}

.config-builder textarea { resize: vertical; }

.cb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem 1rem;
}

.cb-num input[type="number"] { width: 6rem; }

.cb-text { display: block; }

.cb-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0.6rem;
  line-height: 1.5;
  font-weight: 400;
}
.cb-help code {
  font-size: 0.7rem;
  padding: 0 0.3em;
}

.cb-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.7rem;
  align-items: start;
  cursor: pointer;
  margin: 0.85rem 0;
}
.cb-toggle input[type="checkbox"] { margin-top: 0.3rem; }
.cb-toggle strong {
  font-weight: 700;
  display: block;
}
.cb-toggle .cb-help { margin: 0.2rem 0 0; }

.cb-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.cb-inline {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.cb-mount-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.cb-mount-row input[type="text"] { flex: 1; min-width: 0; }
.cb-mount-row .cb-inline { white-space: nowrap; }

.config-builder [data-remove],
.config-builder [data-add-mount] {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--rule-soft);
  padding: 0.35rem 0.6rem;
  border-radius: 0;
  cursor: pointer;
  line-height: 1;
  transition: border-color 150ms ease, color 150ms ease;
}
.config-builder [data-remove] {
  font-size: 1rem;
  padding: 0.15rem 0.5rem;
}
.config-builder [data-add-mount] {
  border-style: dashed;
  margin-top: 0.4rem;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.config-builder [data-remove]:hover,
.config-builder [data-add-mount]:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.cb-allowlist {
  margin-top: 0.7rem;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
}
.cb-allowlist[hidden] { display: none; }
.cb-allowlist textarea {
  font-size: 0.78rem;
  line-height: 1.6;
}

[data-config-output] {
  margin-top: 1.5rem;
}

.cb-caveat {
  font-family: var(--sans);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1rem;
  margin: 1.5rem 0;
}

/* ============================ Tool tiles ============================ */

.tool-tiles {
  list-style: none;
  padding: 0;
  margin: 2rem 0 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.tool-tile {
  display: block;
  position: relative;
  padding: 1.5rem 1.6rem 1.6rem;
  border: 1.5px solid var(--ink);
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tool-tile:hover, .tool-tile:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 0 var(--accent);
  outline: none;
}

.tool-tile h2 {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 0.45rem;
  padding-right: 2.5rem;
  line-height: 1.3;
}

.tool-tile p {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.tool-tile::after {
  content: "";
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 0.95rem;
  height: 0.95rem;
  background: var(--accent);
}

/* On the tools index, wedge a top tools intro line */
.tools-intro {
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 60ch;
  margin: 0 0 2rem;
  color: var(--text-muted);
}
