/*
 * dalix.css: design standard for dalix.dev sites
 * https://colors.dalix.dev
 *
 * <link rel="stylesheet" href="https://colors.dalix.dev/dalix.css">
 */

/* Fonts ------------------------------------------------------------------ */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/archivo-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/archivo-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/archivo-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/archivo-latin-ext-wght-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-ext-wght-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Monaspace Radon";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/monaspace-radon-wght.woff2) format("woff2");
}

/* Tokens ----------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Teal */
  --teal-50: #edfaf8;
  --teal-100: #daf4f0;
  --teal-200: #b7e8e0;
  --teal-300: #87d3c8;
  --teal-400: #4fb7aa;
  --teal-500: #029386;
  --teal-600: #007b70;
  --teal-700: #02655c;
  --teal-800: #084f48;
  --teal-900: #083630;

  --accent: var(--teal-500);        /* fills, borders, logo, focus */
  --accent-strong: var(--teal-600); /* links and teal text under 18px */
  --accent-soft: var(--teal-50);    /* selected and highlighted rows */

  /* Neutral */
  --ink: #0b1e24;         /* headings, strong text */
  --body: #43606a;        /* body text */
  --muted: #5a7279;       /* captions, hints, placeholders */
  --line-strong: #aabbc0; /* input borders */
  --line: #d5e0e4;        /* card borders, dividers */
  --subtle: #e9eff1;      /* hover fills */
  --canvas: #f4f7f8;      /* page background */
  --surface: #ffffff;     /* cards, inputs, code */

  /* Status */
  --danger: #ba3535;
  --danger-soft: #ffefee;
  --warning: #995b03;
  --warning-soft: #fff4e1;
  --success: #387d3d;
  --success-soft: #eaf8e9;

  /* Type */
  --font-sans: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-note: "Monaspace Radon", "JetBrains Mono", ui-monospace, monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 21px;
  --text-2xl: 24px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --text-5xl: 60px;

  /* Shape */
  --radius: 10px;
  --chamfer: 20px;
  --chamfer-sm: 12px;
  --border: 1px;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Layout */
  --container: 1160px;
  --gutter: 24px;
  --header-h: 64px;
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
}

/* Base ------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); line-height: 1.08; letter-spacing: -0.025em; }
h2 { font-size: var(--text-3xl); line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-size: var(--text-2xl); line-height: 1.3; letter-spacing: -0.01em; }
h4 { font-size: var(--text-lg); line-height: 1.4; }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--teal-700); text-decoration-thickness: 2px; }

strong, b { font-weight: 600; color: var(--ink); }

code, kbd, samp, pre { font-family: var(--font-mono); font-variant-ligatures: none; }
code { font-size: 0.9em; color: var(--ink); }
a code { color: inherit; }

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

hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-7) 0; }

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

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

@media (max-width: 720px) {
  h1 { font-size: 36px; }
  h2 { font-size: 30px; }
  h3 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Layout ----------------------------------------------------------------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--space-9) 0; }
.section:last-of-type { padding-bottom: var(--space-9); }
.section > .container > h2 { margin-bottom: var(--space-6); }

.grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-min, 260px)), 1fr));
}

@media (max-width: 720px) {
  .section { padding-top: var(--space-8); }
  .section:last-of-type { padding-bottom: var(--space-8); }
}

/* Header and footer ------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header > .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--ink); }
.logo span { color: var(--accent); }

.site-nav { display: flex; gap: var(--space-1); }
.site-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--subtle); }
.site-nav a[aria-current] { color: var(--accent-strong); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-6);
}
.site-footer > .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-footer .logo { font-size: 18px; }

@media (max-width: 800px) {
  .site-header { position: static; }
  .site-header > .container { flex-wrap: wrap; row-gap: 0; padding-top: var(--space-4); }
  .site-nav {
    width: calc(100% + 2 * var(--gutter));
    margin-inline: calc(-1 * var(--gutter));
    padding: var(--space-2) calc(var(--gutter) - var(--space-3));
    overflow-x: auto;
    scrollbar-width: none;
  }
  html { scroll-padding-top: var(--space-4); }
}

/* Hero: always centered ------------------------------------------------- */

.hero {
  padding-block: var(--space-10) var(--space-6);
  text-align: center;
}
.hero h1 {
  font-size: var(--text-5xl);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.hero p {
  max-width: 36em;
  margin: var(--space-5) auto 0;
  font-size: var(--text-lg);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

@media (max-width: 720px) {
  .hero { padding-block: var(--space-8) var(--space-4); }
  .hero h1 { font-size: 40px; }
}

/* Card: top-left and bottom-right corners cut, the others rounded -------- */

.card {
  --card-line: var(--line);
  --bw: var(--border);
  --c: var(--chamfer);
  position: relative;
  isolation: isolate;
  display: block;
  padding: var(--space-6);
  color: var(--body);
  text-decoration: none;
  background: var(--card-line);
  border-radius: var(--radius);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  transition: background-color 0.15s ease;
}
/* The fill sits one border-width inside; the diagonal inset keeps the cut edge the same weight. */
.card::before {
  --ci: calc(var(--c) - var(--bw) * 0.5858);
  content: "";
  position: absolute;
  inset: var(--bw);
  z-index: -1;
  background: var(--surface);
  border-radius: calc(var(--radius) - var(--bw));
  clip-path: polygon(var(--ci) 0, 100% 0, 100% calc(100% - var(--ci)), calc(100% - var(--ci)) 100%, 0 100%, 0 var(--ci));
}
.card h3 {
  margin-bottom: var(--space-2);
  font-size: var(--text-xl);
  line-height: 1.3;
}
.card .tile { margin-bottom: var(--space-5); }

.card-accent { --card-line: var(--accent); }

a.card:hover { --card-line: var(--accent); color: var(--body); }
a.card:focus-visible { --card-line: var(--accent); --bw: 2px; outline: none; }

@media (max-width: 720px) {
  .card { padding: var(--space-5); }
}

/* Tile: the chamfered teal badge used on cards */

.tile {
  --c: var(--chamfer-sm);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

/* Highlighted initial in a card title */
.mark { color: var(--accent); }

/* Button ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }

.btn-text { border-color: transparent; background: transparent; color: var(--accent-strong); padding-inline: var(--space-3); }
.btn-text:hover { border-color: transparent; background: var(--accent-soft); color: var(--teal-700); }

.btn-sm { height: 36px; padding: 0 14px; font-size: var(--text-sm); }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Form ------------------------------------------------------------------- */

.field { display: grid; gap: 6px; }

.label { font-size: var(--text-sm); font-weight: 600; color: var(--ink); }

.hint { font-size: 13px; color: var(--muted); }
.hint-error { color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: #8fa3a9; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--teal-100);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2343606a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

.textarea { height: auto; min-height: 112px; padding: var(--space-3) 14px; resize: vertical; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* Tag -------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.tag-accent { background: var(--teal-100); color: var(--teal-700); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

/* Code block: plain, no window chrome ------------------------------------ */

.code {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.code pre {
  margin: 0;
  padding: 20px 24px;
  overflow-x: auto;
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.7;
  tab-size: 2;
}
.code pre code { font-size: inherit; }
.code > .btn { position: absolute; top: 10px; right: 10px; }
.code:has(> .btn) pre { padding-right: 96px; }

@media (max-width: 720px) {
  .code pre { padding: var(--space-4); }
  .code:has(> .btn) pre { padding-top: 56px; }
}

.tok-tag { color: var(--teal-700); }
.tok-attr { color: var(--body); }
.tok-str { color: var(--teal-600); }
.tok-com { color: var(--muted); font-family: var(--font-note); font-variant-ligatures: normal; }

/* Table ------------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.table th, .table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--canvas);
}
.table tr:last-child td { border-bottom: 0; }

/* Utility ---------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
