@import "tailwindcss";

/* ==========================================================================
   RoboLearn design system — Tailwind v4
   Brand scale lives in @theme; semantic surface tokens live in :root/.dark and
   are exposed to utilities through @theme inline so dark mode "just works".
   ========================================================================== */

@custom-variant dark (&:where(.dark, .dark *));

@theme {
  /* Brand — warm ink, matching the prospectus palette.
     `brand-600` is the primary action surface (near-black); the signal
     accent carries hover and active states. */
  --color-brand-50: #eae6db;
  --color-brand-100: #ded9cb;
  --color-brand-200: #c6c0af;
  --color-brand-300: #a8a191;
  --color-brand-400: #6b675c;
  --color-brand-500: #4a463a;
  --color-brand-600: #26241c;
  --color-brand-700: #16150f;
  --color-brand-800: #0e0d09;
  --color-brand-900: #080703;
  --color-brand-950: #040402;

  /* Accent — the signal orange. One accent, used sparingly. */
  --color-accent-300: #f0a07c;
  --color-accent-400: #e8753f;
  --color-accent-500: #d93a0b;
  --color-accent-600: #b92f08;
  --color-accent-700: #932505;

  /* Status scales */
  --color-success-50: #e9f0ea;
  --color-success-100: #d3e2d6;
  --color-success-500: #2f7d52;
  --color-success-600: #256444;
  --color-success-700: #1c4c33;

  --color-warning-50: #f7efdc;
  --color-warning-100: #eddfbe;
  --color-warning-500: #b07908;
  --color-warning-600: #8f6206;
  --color-warning-700: #6f4c05;

  --color-danger-50: #f8e8e5;
  --color-danger-100: #f0d1cb;
  --color-danger-500: #c0392b;
  --color-danger-600: #a52f22;
  --color-danger-700: #83251a;

  --color-info-50: #e6eef3;
  --color-info-100: #cddfe8;
  --color-info-500: #2c6e8f;
  --color-info-600: #235a75;
  --color-info-700: #1b455c;

  /* Square corners everywhere — the print language has no rounded geometry.
     `rounded-full` is left alone so avatars stay circular. */
  --radius-xs: 0px;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;
  --radius-2xl: 0px;
  --radius-3xl: 0px;
  --radius-4xl: 0px;
  --radius-card: 0px;

  /* Public landing page — "engineering prospectus" palette.
     Warm stock, near-black ink, one signal accent. Not part of the LMS UI. */
  --color-doc-paper: #f2efe7;
  --color-doc-paper-2: #e7e3d8;
  --color-doc-paper-3: #dcd7c9;
  --color-doc-ink: #16150f;
  --color-doc-ink-2: #3d3a31;
  --color-doc-ink-3: #6b675c;
  --color-doc-line: #c6c0af;
  --color-doc-signal: #d93a0b;
  --color-doc-signal-tint: #fbe3d9;

  --font-display: var(--font-archivo), var(--font-inter), ui-sans-serif,
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --font-sans: var(--font-inter), ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: var(--font-mono-code), ui-monospace, "Cascadia Code",
    "Source Code Pro", Menlo, Consolas, monospace;

  --shadow-card: none;
  --shadow-raised: none;
  /* Hard-edged offset — a printed card lifted off the sheet. */
  --shadow-overlay: 4px 4px 0 0 rgb(22 21 15 / 0.14);

  --animate-fade-in: fade-in 0.2s ease-out;
  --animate-slide-up: slide-up 0.25s ease-out;
  --animate-scale-in: scale-in 0.18s ease-out;
}

/* --------------------------------------------------------------------------
   Semantic tokens — light mode
   -------------------------------------------------------------------------- */

:root {
  /* Paper stock, progressively darker — cards read as sheets laid on the
     canvas, never as floating panels. */
  --surface-canvas: #f2efe7;
  --surface-raised: #faf8f2;
  --surface-sunken: #e7e3d8;
  --surface-overlay: #faf8f2;
  --surface-hover: #ece8dd;
  --surface-active: #ded9cb;

  --border-subtle: #ddd7c8;
  --border-default: #c6c0af;
  --border-strong: #a8a191;

  --text-primary: #16150f;
  --text-secondary: #3d3a31;
  --text-tertiary: #6b675c;
  --text-inverse: #f2efe7;

  --focus-ring: #d93a0b;
}

.dark {
  --surface-canvas: #14130e;
  --surface-raised: #1c1a13;
  --surface-sunken: #100f0b;
  --surface-overlay: #221f17;
  --surface-hover: #262318;
  --surface-active: #2e2a1d;

  --border-subtle: #302c1e;
  --border-default: #443f2c;
  --border-strong: #5c563c;

  --text-primary: #f2efe7;
  --text-secondary: #b3ad9d;
  --text-tertiary: #7d786a;
  --text-inverse: #14130e;

  --focus-ring: #e8753f;
}

/* Expose semantic tokens as Tailwind colour utilities (dark-mode aware). */
@theme inline {
  --color-canvas: var(--surface-canvas);
  --color-surface: var(--surface-raised);
  --color-sunken: var(--surface-sunken);
  --color-overlay: var(--surface-overlay);
  --color-hover: var(--surface-hover);
  --color-active: var(--surface-active);

  --color-subtle: var(--border-subtle);
  --color-line: var(--border-default);
  --color-line-strong: var(--border-strong);

  --color-primary: var(--text-primary);
  --color-secondary: var(--text-secondary);
  --color-tertiary: var(--text-tertiary);
  --color-inverse: var(--text-inverse);
}

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

@layer base {
  * {
    border-color: var(--border-subtle);
  }

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

  body {
    background-color: var(--surface-canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Grid and flex children default to `min-width: auto`, which lets a
     `truncate`/`nowrap` descendant dictate the track width and blow out the
     viewport on narrow screens. Zeroing it lets the tracks shrink instead.
     Scoped to page content so layout shells keep their intrinsic sizing. */
  main .grid > *,
  main [class*="grid-cols"] > * {
    min-width: 0;
  }

  /* A horizontal scroller must also be a containing block, otherwise an
     absolutely-positioned descendant (e.g. `.sr-only` labels inside tables)
     escapes it and stretches the whole document. */
  main [class*="overflow-x-auto"],
  main [class*="overflow-x-scroll"] {
    position: relative;
  }

  /* The 72px drafting grid, faint enough to read as paper texture. */
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
      linear-gradient(to right, rgb(22 21 15 / 0.045) 1px, transparent 1px),
      linear-gradient(to bottom, rgb(22 21 15 / 0.045) 1px, transparent 1px);
    background-size: 72px 72px;
  }

  .dark body::before {
    background-image:
      linear-gradient(to right, rgb(242 239 231 / 0.04) 1px, transparent 1px),
      linear-gradient(to bottom, rgb(242 239 231 / 0.04) 1px, transparent 1px);
  }

  :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 0;
  }

  ::selection {
    background-color: var(--color-accent-500);
    color: var(--color-doc-paper);
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background-color: var(--border-default);
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-strong);
    background-clip: content-box;
  }

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

/* --------------------------------------------------------------------------
   Prose styling for lesson markdown
   -------------------------------------------------------------------------- */

@layer components {
  .lesson-content {
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: 0.9375rem;
  }
  .lesson-content h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
  }
  .lesson-content h3 {
    color: var(--text-primary);
    font-size: 1.0625rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
  }
  .lesson-content p {
    margin-bottom: 1rem;
  }
  .lesson-content strong {
    color: var(--text-primary);
    font-weight: 600;
  }
  .lesson-content a {
    color: var(--color-accent-600);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .dark .lesson-content a {
    color: var(--color-accent-400);
  }
  .lesson-content ul,
  .lesson-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
  }
  .lesson-content ul {
    list-style-type: disc;
  }
  .lesson-content ol {
    list-style-type: decimal;
  }
  .lesson-content li {
    margin-bottom: 0.375rem;
  }
  .lesson-content li::marker {
    color: var(--text-tertiary);
  }
  .lesson-content blockquote {
    border-left: 3px solid var(--color-accent-500);
    background-color: var(--surface-sunken);
    padding: 0.75rem 1rem;
    margin: 1.25rem 0;
  }
  .lesson-content blockquote p:last-child {
    margin-bottom: 0;
  }
  .lesson-content code {
    background-color: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    padding: 0.125rem 0.375rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-primary);
  }
  .lesson-content pre {
    background-color: var(--color-brand-950);
    color: var(--color-doc-paper);
    border: 1px solid var(--border-subtle);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.8125rem;
    line-height: 1.65;
  }
  .lesson-content pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
  }
  .lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.875rem;
    border: 1px solid var(--border-subtle);
  }
  .lesson-content th {
    background-color: var(--surface-sunken);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: left;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-default);
  }
  .lesson-content td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
  }
  .lesson-content tr:last-child td {
    border-bottom: none;
  }
  .lesson-content hr {
    border-color: var(--border-subtle);
    margin: 2rem 0;
  }

  /* ------------------------------------------------------------------------
     Workspace language
     The dashboard reuses the prospectus vocabulary: a monospaced folio marker,
     a rule-topped section head, and a "plate" that replaces the floating card.
     ------------------------------------------------------------------------ */

  /* Small monospaced annotation. */
  .ws-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
  }

  /* Monospaced uppercase micro-label, used for eyebrows and table heads. */
  .ws-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-tertiary);
  }

  /* Display heading — the same face the prospectus uses for titles. */
  .ws-display {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
  }

  /* The numbered index tab: [ 03 ]. */
  .ws-folio {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
  }
  .ws-folio::before {
    content: "[";
    color: var(--color-accent-500);
  }
  .ws-folio::after {
    content: "]";
    color: var(--color-accent-500);
  }

  /* Hairline rules. */
  .ws-rule {
    border-top: 1px solid var(--border-subtle);
  }
  .ws-rule-strong {
    border-top: 1.5px solid var(--text-primary);
  }

  /* A sheet laid on the canvas: hairline border, no elevation. */
  .ws-plate {
    border: 1px solid var(--border-subtle);
    background: var(--surface-raised);
  }

  /* Section head with a rule above and a monospaced title. */
  .ws-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1.5px solid var(--text-primary);
    padding-top: 0.625rem;
  }
  .ws-head h2,
  .ws-head h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
  }
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.85); opacity: 0.6; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

@layer utilities {
  .skeleton {
    background: linear-gradient(
      90deg,
      var(--surface-sunken) 0%,
      var(--surface-hover) 50%,
      var(--surface-sunken) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
  }

  .sim-grid-cell {
    transition: background-color 120ms ease-out;
  }

  .sim-robot {
    transition: left 220ms cubic-bezier(0.4, 0, 0.2, 1),
      top 220ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sim-robot-blocked {
    animation: shake 0.3s ease-in-out;
  }

  .scrollbar-none {
    scrollbar-width: none;
  }
  .scrollbar-none::-webkit-scrollbar {
    display: none;
  }
}

/* ==========================================================================
   Public landing page — engineering prospectus
   Deliberately unlike the LMS UI: warm stock, near-black ink, hairline rules,
   monospaced annotations and a single signal accent. Every rule is scoped to
   `.landing-root` so the product design system is untouched.
   ========================================================================== */

:is(.landing-root, .doc-root) {
  --paper: var(--color-doc-paper);
  --paper-2: var(--color-doc-paper-2);
  --paper-3: var(--color-doc-paper-3);
  --ink: var(--color-doc-ink);
  --ink-2: var(--color-doc-ink-2);
  --ink-3: var(--color-doc-ink-3);
  --rule: var(--color-doc-line);
  --signal: var(--color-doc-signal);
  --signal-tint: var(--color-doc-signal-tint);

  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  /* Faint engineering grid, printed on the stock. */
  background-image:
    linear-gradient(to right, rgb(22 21 15 / 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(22 21 15 / 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
}

:is(.landing-root, .doc-root) ::selection {
  background: var(--signal);
  color: var(--paper);
}

/* Typography --------------------------------------------------------------- */

:is(.landing-root, .doc-root) .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-transform: uppercase;
}

:is(.landing-root, .doc-root) .label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

:is(.landing-root, .doc-root) .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Rules & structure -------------------------------------------------------- */

:is(.landing-root, .doc-root) .rule {
  border-top: 1px solid var(--rule);
}

:is(.landing-root, .doc-root) .rule-strong {
  border-top: 1.5px solid var(--ink);
}

/* The numbered section marker: [ 03 ] — a printed index tab. */
:is(.landing-root, .doc-root) .folio {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: var(--paper);
  white-space: nowrap;
}

/* Plates: the only "card" in this layout. Square corners, hairline border,
   no shadow — like a printed figure box. */
:is(.landing-root, .doc-root) .plate {
  border: 1px solid var(--rule);
  background: rgb(255 255 255 / 0.45);
}

:is(.landing-root, .doc-root) .plate-solid {
  border: 1px solid var(--rule);
  background: var(--paper-2);
}

:is(.landing-root, .doc-root) .plate-invert {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

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

:is(.landing-root, .doc-root) .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

:is(.landing-root, .doc-root) .btn:hover {
  background: var(--signal);
  border-color: var(--signal);
}

:is(.landing-root, .doc-root) .btn-ghost {
  background: transparent;
  color: var(--ink);
}

:is(.landing-root, .doc-root) .btn-ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

:is(.landing-root, .doc-root) .btn:active {
  transform: translateY(1px);
}

/* Underline that draws in on hover — used on inline links. */
:is(.landing-root, .doc-root) .link-draw {
  background-image: linear-gradient(var(--signal), var(--signal));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

:is(.landing-root, .doc-root) .link-draw:hover {
  background-size: 100% 1px;
}

/* Imagery ------------------------------------------------------------------ */

/* Duotone-ish treatment: desaturate and warm the photography so it sits on
   the paper instead of fighting it. */
:is(.landing-root, .doc-root) .plate-img {
  filter: grayscale(1) contrast(1.08) sepia(0.22);
  transition:
    filter 0.4s ease,
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

:is(.landing-root, .doc-root) .plate-img:hover {
  filter: grayscale(0) contrast(1) sepia(0);
}

:is(.landing-root, .doc-root) .zoom-parent:hover .plate-img {
  transform: scale(1.04);
}

/* Marquee ------------------------------------------------------------------ */

@keyframes doc-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

:is(.landing-root, .doc-root) .doc-marquee-track {
  display: flex;
  width: max-content;
  animation: doc-marquee 52s linear infinite;
  will-change: transform;
}

:is(.landing-root, .doc-root) .doc-marquee:hover .doc-marquee-track {
  animation-play-state: paused;
}

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

@keyframes doc-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:is(.landing-root, .doc-root) .rise {
  animation: doc-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Hero backdrop crossfade — kept on the wrapper so slides can stack. */
@keyframes doc-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

:is(.landing-root, .doc-root) .fade-in {
  animation: doc-fade 0.9s ease-out both;
}

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

/* Square, hairline-bordered inputs. The LMS `.Input` component is rounded and
   shadowed; on the prospectus pages the same element is restyled to read as a
   printed form field. Selectors are scoped so no other screen is affected. */
:is(.landing-root, .doc-root) .doc-field {
  width: 100%;
  height: 2.75rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: #fff;
  padding: 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink);
  box-shadow: none;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease;
}

:is(.landing-root, .doc-root) .doc-field::placeholder {
  color: var(--ink-3);
}

:is(.landing-root, .doc-root) .doc-field:hover {
  border-color: var(--ink-3);
}

:is(.landing-root, .doc-root) .doc-field:focus {
  outline: none;
  border-color: var(--ink);
  background: #fff;
  box-shadow: inset 0 -2px 0 0 var(--signal);
}

:is(.landing-root, .doc-root) .doc-field:disabled {
  background: var(--paper-2);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Padding helpers for the leading icon / trailing toggle. */
:is(.landing-root, .doc-root) .doc-field-icon {
  padding-left: 2.25rem;
}

:is(.landing-root, .doc-root) .doc-field-toggle {
  padding-right: 2.5rem;
}

/* Native select, restyled to match. */
:is(.landing-root, .doc-root) select.doc-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b675c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

/* Field label / hint / error slots, printed rather than bold sans. */
:is(.landing-root, .doc-root) .doc-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

:is(.landing-root, .doc-root) .doc-hint {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-3);
}

:is(.landing-root, .doc-root) .doc-error {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--signal);
}

/* Notice banner for form-level failures. */
:is(.landing-root, .doc-root) .doc-notice {
  display: flex;
  gap: 0.75rem;
  border: 1px solid var(--signal);
  border-left-width: 3px;
  background: var(--signal-tint);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink);
}

/* Tab pair used for the login/register switch. */
:is(.landing-root, .doc-root) .doc-tab {
  flex: 1;
  border: 1px solid var(--rule);
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

:is(.landing-root, .doc-root) .doc-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}

:is(.landing-root, .doc-root) .doc-tab[data-active="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  :is(.landing-root, .doc-root) .rise,
  :is(.landing-root, .doc-root) .fade-in,
  :is(.landing-root, .doc-root) .doc-marquee-track,
  :is(.landing-root, .doc-root) .plate-img,
  :is(.landing-root, .doc-root) .btn {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Certificate document
   ========================================================================== */

/*
 * A certificate is a printed object, so the sheet is always white stock with
 * near-black ink — even when the viewer is in dark mode. Screen styling mirrors
 * the print result exactly, so what you see is what comes out of the printer.
 */
.cert-sheet {
  --cert-ink: #16150f;
  --cert-ink-2: #3d3a31;
  --cert-ink-3: #6b675c;
  --cert-rule: #c6c0af;
  --cert-paper: #fdfcf8;
  --cert-signal: #d93a0b;

  position: relative;
  border: 1px solid var(--cert-rule);
  background: var(--cert-paper);
  color: var(--cert-ink);
  /* Force the paper and ink to survive the print pipeline; browsers drop
     backgrounds by default and the document would print as bare text. */
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Corner brackets, drawn with borders so no image asset is needed. */
.cert-sheet::before,
.cert-sheet::after {
  content: "";
  position: absolute;
  width: 2.25rem;
  height: 2.25rem;
  border-color: var(--cert-signal);
  border-style: solid;
  pointer-events: none;
}

.cert-sheet::before {
  top: 0.7rem;
  left: 0.7rem;
  border-width: 2px 0 0 2px;
}

.cert-sheet::after {
  right: 0.7rem;
  bottom: 0.7rem;
  border-width: 0 2px 2px 0;
}

.cert-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* A signature line — the rule a name is written above. */
.cert-sign-rule {
  border-top: 1px solid var(--cert-ink-3);
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  /* The document is the only thing on the sheet. */
  .cert-sheet {
    border: none;
    background: #ffffff;
  }

  /* Anything marked as screen-only must not reach the printer. */
  .cert-no-print {
    display: none !important;
  }
}
