:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #11141b;
  --panel-raised: #171b23;
  --line: #292e38;
  --line-bright: #3c4350;
  --text: #f4f3ee;
  --muted: #a6a9b1;
  --faint: #6f747f;
  --accent: #e7bd58;
  --accent-bright: #f3ce70;
  --accent-ink: #18140a;
  --blue: #7497d8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 75% 15%, rgba(57, 68, 92, .18), transparent 27rem),
    var(--bg);
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: .75rem;
  left: .75rem;
  padding: .6rem .9rem;
  color: var(--accent-ink);
  background: var(--accent-bright);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header,
.site-footer {
  width: min(1200px, calc(100% - 3rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header { min-height: 5.25rem; border-bottom: 1px solid rgba(255, 255, 255, .07); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  color: var(--text);
  font-weight: 720;
  letter-spacing: -.03em;
  text-decoration: none;
}

.wordmark-mark { position: relative; width: 1.45rem; height: 1.45rem; transform: rotate(-16deg); }
.wordmark-mark span { position: absolute; width: .62rem; height: .62rem; border: 1px solid var(--accent); background: rgba(231, 189, 88, .12); }
.wordmark-mark span:nth-child(1) { top: 0; left: .42rem; }
.wordmark-mark span:nth-child(2) { bottom: 0; left: 0; }
.wordmark-mark span:nth-child(3) { right: 0; bottom: 0; }

.site-nav { display: flex; align-items: center; gap: 1.35rem; }
.site-nav > a:not(.button), .text-link { color: var(--muted); text-decoration: none; }
.site-nav > a:not(.button):hover, .text-link:hover { color: var(--text); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .78rem 1.15rem;
  border: 1px solid var(--accent-bright);
  border-radius: .35rem;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: 0 12px 35px rgba(231, 189, 88, .12);
  font-weight: 720;
  text-decoration: none;
}

.button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.button-small { min-height: 2.45rem; padding: .55rem .85rem; font-size: .9rem; }
.button-secondary { color: var(--text); border-color: var(--line-bright); background: var(--panel-raised); box-shadow: none; }
a:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.hero {
  width: min(1200px, calc(100% - 3rem));
  min-height: 690px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: 5rem;
  padding: 5rem 0 6rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent-bright);
  font-size: .72rem;
  font-weight: 780;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3 { margin-top: 0; line-height: 1.04; letter-spacing: -.055em; }
.hero h1 { margin-bottom: 1.6rem; font-size: clamp(3.2rem, 6.2vw, 6.2rem); font-weight: 650; }
.hero h1 span { color: var(--accent-bright); }
.hero-summary { max-width: 34rem; margin: 0; color: var(--muted); font-size: 1.15rem; }
.hero-actions { display: flex; align-items: center; gap: 1.4rem; margin-top: 2rem; }
.text-link { font-weight: 650; }
.value-list { display: flex; flex-wrap: wrap; gap: .8rem 1.1rem; margin: 2.4rem 0 0; padding: 0; color: var(--faint); font-size: .78rem; list-style: none; }
.value-list span { display: inline-block; width: .4rem; height: .4rem; margin-right: .45rem; border-radius: 50%; background: var(--accent); }

.diagram-preview {
  overflow: hidden;
  min-height: 490px;
  border: 1px solid var(--line-bright);
  border-radius: .65rem;
  background: #0d1016;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .05);
  transform: perspective(1100px) rotateY(-5deg) rotateX(2deg);
}

.preview-toolbar { height: 46px; display: flex; align-items: center; gap: .42rem; padding: 0 1rem; border-bottom: 1px solid var(--line); background: #151820; }
.preview-toolbar span { width: .48rem; height: .48rem; border-radius: 50%; background: #424853; }
.preview-toolbar b { margin-left: .7rem; font-size: .68rem; font-weight: 650; color: #bec1c8; }
.preview-toolbar i { margin-left: auto; color: var(--faint); font-size: .65rem; font-style: normal; }
.preview-canvas { position: relative; height: 443px; overflow: hidden; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 26px 26px; }
.grid-glow { position: absolute; inset: 0; background: radial-gradient(circle at 62% 48%, rgba(116, 151, 216, .13), transparent 38%); }
.group-card { position: absolute; left: 42%; top: 20%; width: 48%; height: 63%; border: 1px solid rgba(231, 189, 88, .35); background: rgba(231, 189, 88, .025); }
.group-card small { position: absolute; top: .7rem; left: .8rem; color: #9e8956; font-size: .55rem; letter-spacing: .16em; }
.node { position: absolute; z-index: 2; width: 130px; min-height: 66px; padding: .85rem 1rem .7rem; border: 1px solid #4a505c; border-radius: .3rem; background: linear-gradient(145deg, #20242d, #171a21); box-shadow: 0 12px 25px rgba(0,0,0,.27); }
.node em { position: absolute; top: 50%; left: -.28rem; width: .48rem; height: .48rem; border: 1px solid var(--accent); border-radius: 50%; background: #16191f; }
.node::after { content: ""; position: absolute; top: 50%; right: -.28rem; width: .48rem; height: .48rem; border: 1px solid var(--accent); border-radius: 50%; background: #16191f; }
.node strong, .node small { display: block; }
.node strong { color: #f0efe9; font-size: .72rem; }
.node small { margin-top: .25rem; color: #7e8490; font-size: .55rem; text-transform: uppercase; letter-spacing: .09em; }
.node-user { left: 6%; top: 40%; }
.node-gateway { left: 37%; top: 25%; border-color: #6a7080; }
.node-auth { left: 70%; top: 40%; border-color: #8d7844; }
.node-data { left: 70%; top: 64%; }
.preview-lines { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; fill: none; stroke: #737b89; stroke-width: 1.5; opacity: .72; }

.principles { width: min(1200px, calc(100% - 3rem)); margin: 0 auto 7rem; padding-top: 5rem; border-top: 1px solid var(--line); }
.principles h2 { max-width: 780px; margin-bottom: 3rem; font-size: clamp(2.2rem, 4vw, 4.3rem); font-weight: 580; }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.principle-grid article { padding: 2rem; background: var(--panel); }
.principle-grid span { color: var(--accent); font: 700 .72rem ui-monospace, monospace; }
.principle-grid h3 { margin: 2.7rem 0 .8rem; font-size: 1.3rem; letter-spacing: -.025em; }
.principle-grid p { margin: 0; color: var(--muted); }

.auth-shell, .error-shell { width: min(720px, calc(100% - 3rem)); min-height: calc(100vh - 10rem); margin: 0 auto; display: grid; place-items: center; padding: 5rem 0; }
.auth-card { width: min(100%, 520px); padding: clamp(2rem, 5vw, 3.5rem); border: 1px solid var(--line); background: linear-gradient(145deg, rgba(27,31,40,.95), rgba(17,20,27,.95)); box-shadow: 0 25px 80px rgba(0,0,0,.25); }
.auth-card h1, .error-shell h1 { margin-bottom: 1rem; font-size: clamp(2.2rem, 5vw, 4rem); }
.auth-note, .error-shell > p:not(.eyebrow) { margin: 0 0 2rem; color: var(--muted); }
.auth-switch { margin: 2rem 0 0; color: var(--faint); font-size: .9rem; }
.auth-switch a { color: var(--text); }
.error-shell { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.auth-form { display: grid; gap: .65rem; margin-top: 1.7rem; }
.auth-form label { color: #d9d8d3; font-size: .82rem; font-weight: 690; }
.auth-form input {
  width: 100%;
  min-height: 3rem;
  margin-bottom: .55rem;
  padding: .72rem .82rem;
  border: 1px solid var(--line-bright);
  border-radius: .32rem;
  color: var(--text);
  background: #0c0f15;
  font: inherit;
}
.auth-form input:hover { border-color: #5a6270; }
.auth-form .button { margin-top: .6rem; cursor: pointer; }
.field-help { margin: -.3rem 0 .55rem; color: var(--faint); font-size: .78rem; }
.form-errors, .form-notice { margin: 1.2rem 0; padding: .9rem 1rem; border-left: 3px solid #d87365; background: rgba(216, 115, 101, .08); color: #f1c5bf; }
.form-errors p { margin: 0; }
.form-errors p + p { margin-top: .35rem; }
.form-notice { border-color: var(--accent); background: rgba(231, 189, 88, .08); color: #e7d5a8; }
.account-card strong { color: var(--text); font-weight: 650; }

.dashboard-shell, .board-open-shell { width: min(1200px, calc(100% - 3rem)); min-height: calc(100vh - 10.75rem); margin: 0 auto; padding: 4.5rem 0 7rem; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.dashboard-heading h1, .board-open-shell h1 { margin-bottom: .75rem; font-size: clamp(2.7rem, 5vw, 5.2rem); font-weight: 620; }
.dashboard-heading p:last-child, .board-open-shell > p:not(.eyebrow) { max-width: 45rem; margin: 0; color: var(--muted); }
.view-tabs { display: flex; gap: .3rem; padding: .3rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--panel); }
.view-tabs a { padding: .45rem .8rem; border-radius: .25rem; color: var(--muted); text-decoration: none; font-size: .85rem; }
.view-tabs a[aria-current="page"] { color: var(--text); background: var(--panel-raised); }
.dashboard-message { max-width: none; margin: 1.5rem 0 0; }
.create-board { margin: 2rem 0; padding: 1.4rem; border: 1px solid var(--line); background: var(--panel); }
.create-board > label, .board-filters label, .rename-board label { display: block; color: var(--faint); font-size: .7rem; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; }
.create-board > div { display: grid; grid-template-columns: 1fr auto; gap: .8rem; margin-top: .55rem; }
.create-board input, .board-filters input, .board-filters select, .rename-board input {
  min-height: 2.8rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line-bright);
  border-radius: .3rem;
  color: var(--text);
  background: #0c0f15;
  font: inherit;
}
.board-filters { display: grid; grid-template-columns: auto minmax(12rem, 1fr) auto minmax(11rem, auto) auto; align-items: center; gap: .7rem; margin: 2rem 0; }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.board-card { min-width: 0; padding: 1.35rem; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(25,29,37,.96), rgba(16,19,25,.96)); box-shadow: 0 16px 36px rgba(0,0,0,.16); }
.board-card-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.board-card time { color: var(--faint); font-size: .68rem; }
.board-glyph { position: relative; display: inline-block; width: 2rem; height: 1.55rem; }
.board-glyph i { position: absolute; width: .6rem; height: .6rem; border: 1px solid var(--accent); border-radius: 2px; background: rgba(231,189,88,.08); }
.board-glyph i:nth-child(1) { top: 0; left: .68rem; }
.board-glyph i:nth-child(2) { bottom: 0; left: .1rem; }
.board-glyph i:nth-child(3) { right: .1rem; bottom: 0; }
.board-card h2 { overflow-wrap: anywhere; margin: 2.1rem 0 1.5rem; font-size: 1.35rem; letter-spacing: -.03em; }
.board-card h2 a { text-decoration: none; }
.board-card h2 a:hover { color: var(--accent-bright); }
.rename-board { display: grid; grid-template-columns: 1fr auto; gap: .45rem; align-items: end; }
.rename-board label { grid-column: 1 / -1; }
.rename-board input { min-width: 0; }
.text-button { padding: .5rem .65rem; border: 1px solid var(--line-bright); border-radius: .25rem; color: var(--muted); background: transparent; cursor: pointer; font: 650 .72rem inherit; }
.text-button:hover { color: var(--text); border-color: #626a77; }
.text-button-danger:hover { color: #f1b4ab; border-color: #8d4e46; }
.board-card-actions { display: flex; gap: .5rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.empty-state { display: grid; justify-items: center; padding: 6rem 2rem; border: 1px dashed var(--line-bright); color: var(--muted); text-align: center; }
.empty-state h2 { margin: 1.4rem 0 .45rem; color: var(--text); font-size: 1.5rem; }
.empty-state p { margin: 0; }
.board-open-shell { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.board-open-shell .button { margin-top: 2rem; }

.site-footer { min-height: 5.5rem; border-top: 1px solid var(--line); color: var(--faint); font-size: .78rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 3rem; padding-top: 4rem; }
  .diagram-preview { transform: none; }
  .principle-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-filters { grid-template-columns: 1fr 1fr; }
  .board-filters label { align-self: end; }
  .board-filters .button { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-header, .site-footer, .hero, .principles { width: min(100% - 2rem, 1200px); }
  .site-nav { gap: .75rem; }
  .site-nav > a:not(.button) { display: none; }
  .hero { min-height: auto; padding: 3.5rem 0 4rem; }
  .hero h1 { font-size: clamp(2.75rem, 14vw, 4rem); }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .diagram-preview { min-height: 390px; }
  .preview-canvas { height: 343px; }
  .node { transform: scale(.78); transform-origin: left center; }
  .node-gateway { left: 34%; }
  .node-auth, .node-data { left: 66%; }
  .dashboard-shell, .board-open-shell { width: min(100% - 2rem, 1200px); padding-top: 3rem; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .create-board > div, .board-grid, .board-filters { grid-template-columns: 1fr; }
  .board-filters .button { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
