/* K-Tech legal pages: shares the main site's warm paper/ink/indigo/copper
   identity and IBM Plex Sans, self-hosted here (latin + latin-ext, 400/700
   only) since these are plain static pages outside the Astro font pipeline. */

:root {
  --paper: #f6f3ec;
  --paper-deep: #efe9dc;
  --white: #fff;
  --ink: #14181d;
  --ink-soft: #1f242b;
  --text: #4b5563;
  --muted: #5f6b76;
  --line: #e2dccb;
  --indigo: #2f4b8f;
  --indigo-bright: #4a6bb5;
  --copper: #a54c1b;
  --copper-bright: #c96a35;
  --copper-ink: #8f4118;
  --white-rgb: 255 255 255;
  --ink-rgb: 20 24 29;
  --indigo-rgb: 47 75 143;
  --copper-rgb: 165 76 27;
  --font-sans:
    "IBM Plex Sans", "Segoe UI Variable", "Segoe UI", helvetica, arial,
    sans-serif;
  --radius-sm: 10px;
  --radius-md: 18px;
  --shadow-sm: 0 10px 34px rgb(var(--ink-rgb) / 12%);
  --shadow-md: 0 24px 70px rgb(var(--ink-rgb) / 12%);
  --transition: 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10151c;
  --paper-deep: #171e27;
  --white: #202936;
  --ink: #f4f0e8;
  --ink-soft: #dce3ed;
  --text: #c6ced8;
  --muted: #aab4c1;
  --line: #344252;
  --indigo: #91aaf0;
  --indigo-bright: #aec0f2;
  --copper: #d67a42;
  --copper-bright: #ee975d;
  --copper-ink: #f1a875;
  --white-rgb: 32 41 54;
  --ink-rgb: 244 240 232;
  --indigo-rgb: 145 170 240;
  --copper-rgb: 214 122 66;
  --shadow-sm: 0 10px 34px rgb(0 0 0 / 28%);
  --shadow-md: 0 24px 70px rgb(0 0 0 / 34%);
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/ibm-plex-sans/ibm-plex-sans-latin-400-normal.woff2")
    format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/fonts/ibm-plex-sans/ibm-plex-sans-latin-700-normal.woff2")
    format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/ibm-plex-sans/ibm-plex-sans-latin-ext-400-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+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/fonts/ibm-plex-sans/ibm-plex-sans-latin-ext-700-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+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.7;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid rgb(var(--indigo-rgb) / 60%);
  outline-offset: 4px;
}

.legal-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.legal-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgb(var(--white-rgb) / 88%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.legal-header-inner {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.legal-logo {
  display: inline-flex;
  align-items: center;
}

.legal-logo img {
  display: block;
  width: 142px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.legal-logo--dark {
  display: none;
}

html[data-theme="dark"] .legal-logo--light {
  display: none;
}

html[data-theme="dark"] .legal-logo--dark {
  display: block;
}

.legal-header nav {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.legal-header nav a {
  text-decoration: none;
  transition: color var(--transition);
}

.legal-header nav a:hover,
.legal-header nav a[aria-current="page"] {
  color: var(--copper-ink);
}

.back-link {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.legal-theme-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

.legal-theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.legal-theme-icon--dark,
html[data-theme="dark"] .legal-theme-icon--light {
  display: none;
}

html[data-theme="dark"] .legal-theme-icon--dark {
  display: block;
}

.legal-hero {
  position: relative;
  overflow: hidden;
  padding-block: 88px 82px;
  background: linear-gradient(160deg, var(--paper) 0%, var(--paper-deep) 100%);
  color: var(--ink);
}

.legal-hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.7;
  background-image:
    linear-gradient(rgb(var(--ink-rgb) / 6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--ink-rgb) / 6%) 1px, transparent 1px);
  background-size: 62px 62px;
  content: "";
  mask-image: radial-gradient(120% 90% at 78% 20%, black 30%, transparent 72%);
  -webkit-mask-image: radial-gradient(
    120% 90% at 78% 20%,
    black 30%,
    transparent 72%
  );
}

.legal-hero::after {
  position: absolute;
  z-index: -1;
  top: -220px;
  right: -160px;
  width: 480px;
  height: 480px;
  border: 1px solid rgb(var(--indigo-rgb) / 16%);
  border-radius: 50%;
  content: "";
}

.legal-kicker {
  margin: 0 0 18px;
  color: var(--copper-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legal-hero h1 {
  max-width: 780px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.legal-hero p:last-child {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--text);
}

.legal-main {
  padding-block: 64px 90px;
}

.legal-grid {
  display: grid;
  gap: 30px;
}

.legal-toc,
.legal-content {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.legal-toc {
  align-self: start;
  padding: 24px;
}

.legal-toc p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.legal-toc a {
  display: block;
  padding-block: 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
  transition: color var(--transition);
}

.legal-toc a:hover {
  color: var(--copper-ink);
}

.legal-content {
  padding: clamp(26px, 5vw, 58px);
}

.legal-updated {
  margin: 0 0 38px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legal-content section + section {
  margin-top: 46px;
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.legal-content h2 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.legal-content h3 {
  margin: 26px 0 8px;
  font-size: 1rem;
}

.legal-content p,
.legal-content li {
  color: var(--text);
}

.legal-content ul {
  margin: 14px 0 0;
  padding-left: 22px;
}

.legal-content li + li {
  margin-top: 8px;
}

.legal-content a {
  color: var(--indigo);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.legal-content a:hover {
  color: var(--copper-ink);
}

.legal-note {
  margin-top: 24px;
  padding: 18px 20px;
  border-inline-start: 4px solid var(--copper);
  border-radius: 0 12px 12px 0;
  background: rgb(var(--copper-rgb) / 8%);
}

.storage-table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.storage-table th,
.storage-table td {
  padding: 13px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.storage-table th {
  background: var(--paper-deep);
  color: var(--ink);
}

.legal-footer {
  padding-block: 36px;
  background: linear-gradient(180deg, var(--ink-soft), var(--ink) 40%);
  color: rgb(var(--white-rgb) / 62%);
}

html[data-theme="dark"] .legal-footer,
html[data-theme="dark"] .error-page {
  --white: #fff;
  --white-rgb: 255 255 255;
  --ink: #14181d;
  --ink-soft: #1f242b;
  --ink-rgb: 20 24 29;
}

.legal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.legal-footer p {
  margin: 0;
  font-size: 0.78rem;
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.legal-footer a {
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition);
}

.legal-footer a:hover {
  color: var(--copper-bright);
}

@media (min-width: 860px) {
  .legal-grid {
    grid-template-columns: 230px minmax(0, 1fr);
    align-items: start;
  }

  .legal-toc {
    position: sticky;
    top: 104px;
  }
}

@media (max-width: 720px) {
  .legal-shell {
    width: min(100% - 28px, 1120px);
  }

  .legal-header-inner {
    min-height: 68px;
    gap: 12px;
  }

  .legal-logo img {
    width: 120px;
  }

  .legal-header nav > a {
    display: none;
  }

  .legal-header nav {
    flex: 0 0 auto;
    gap: 8px;
  }

  .legal-hero {
    padding-block: 64px 60px;
  }

  .legal-main {
    padding-block: 34px 60px;
  }

  .legal-content {
    border-radius: 16px;
  }

  .storage-table {
    display: block;
    overflow-x: auto;
  }

  .legal-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  .legal-header,
  .legal-toc,
  .legal-footer {
    display: none;
  }

  .legal-hero::before,
  .legal-hero::after {
    display: none;
  }

  .legal-hero {
    padding-block: 20px;
    background: none;
    color: black;
  }

  .legal-hero p:last-child,
  .legal-content p,
  .legal-content li {
    color: black;
  }

  .legal-main {
    padding: 0;
  }

  .legal-content {
    padding: 20px 0;
    border: 0;
    box-shadow: none;
  }
}

/* Custom GitHub Pages 404 page: the same ink anchor used at the end of the
   main site (contact section/footer), not a separate dark theme. */
.error-page {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--ink), var(--ink-soft));
  color: var(--white);
}

.error-page::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgb(var(--white-rgb) / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--white-rgb) / 5%) 1px, transparent 1px);
  background-size: 62px 62px;
  content: "";
  mask-image: radial-gradient(90% 80% at 82% 15%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(
    90% 80% at 82% 15%,
    black 30%,
    transparent 75%
  );
}

.error-page::after {
  position: absolute;
  z-index: -1;
  right: -170px;
  bottom: -190px;
  width: 460px;
  height: 460px;
  border: 1px solid rgb(var(--copper-rgb) / 22%);
  border-radius: 50%;
  content: "";
}

.error-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(720px, calc(100% - 40px));
  min-height: 100vh;
  margin-inline: auto;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding-block: 56px;
}

.error-logo {
  display: block;
  width: 190px;
  margin-bottom: 70px;
}

.error-logo img {
  width: 100%;
}

.error-code {
  margin: 0 0 8px;
  color: var(--copper-bright);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.error-shell h1 {
  margin: 0;
  color: var(--white);
  font-size: clamp(3rem, 10vw, 6.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.error-shell > p:not(.error-code) {
  max-width: 600px;
  margin: 26px 0 0;
  color: rgb(var(--white-rgb) / 66%);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.error-actions a {
  padding: 12px 18px;
  border: 1px solid rgb(var(--white-rgb) / 20%);
  border-radius: 999px;
  color: var(--white);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
  transition:
    background-color var(--transition),
    border-color var(--transition);
}

.error-actions .error-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--copper), var(--copper-bright));
  color: var(--white);
}
