/* =============================================================================
   Krakti — Base / Reset
   assets/css/base.css  —  enqueued as 'krakti-base' (deps: krakti-tokens)
   Modern reset + element typography bound to tokens. No component cosmetics.
   ============================================================================= */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
  /* Anchor offset so sticky masthead never hides jump targets. */
  scroll-padding-top: calc(var(--k-tap) + var(--k-space-lg));
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background-color: var(--k-color-paper);
  color: var(--k-color-ink);
  font-family: var(--k-font-sans);
  font-size: var(--k-fs-body);
  font-weight: var(--k-weight-regular);
  line-height: var(--k-lh-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
}

/* -----------------------------------------------------------------------------
   MEDIA DEFAULTS — prevent overflow + CLS
   ----------------------------------------------------------------------------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img,
video {
  height: auto;
}

svg {
  fill: currentColor;
}

/* -----------------------------------------------------------------------------
   TYPOGRAPHY — element defaults bound to tokens (serif display, sans body)
   ----------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--k-font-display);
  font-weight: var(--k-weight-display);
  line-height: var(--k-lh-heading);
  letter-spacing: var(--k-ls-heading);
  color: var(--k-color-ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--k-fs-h1);
  line-height: var(--k-lh-display);
  letter-spacing: var(--k-ls-display);
}

h2 {
  font-size: var(--k-fs-h2);
  line-height: var(--k-lh-display);
  letter-spacing: var(--k-ls-display);
}

h3 {
  font-size: var(--k-fs-h3);
}

h4 {
  font-size: var(--k-fs-h4);
}

h5 {
  font-size: var(--k-fs-h5);
}

h6 {
  font-size: var(--k-fs-h6);
}

p,
ul,
ol,
dl,
blockquote,
figure,
table,
pre {
  font-size: inherit;
}

p {
  text-wrap: pretty;
}

small {
  font-size: var(--k-fs-small);
}

strong,
b {
  font-weight: var(--k-weight-semibold);
}

/* Balanced em across serif/sans contexts. */
em,
i {
  font-style: italic;
}

/* -----------------------------------------------------------------------------
   LISTS — strip defaults; components opt back in where needed.
   ----------------------------------------------------------------------------- */
ul,
ol {
  padding: 0;
  list-style: none;
}

/* -----------------------------------------------------------------------------
   LINKS — inherit by default; accent applied per-component / in prose.
   ----------------------------------------------------------------------------- */
a {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: max(0.06em, 1px);
  text-underline-offset: 0.16em;
  transition: var(--k-transition-colors);
}

a:hover {
  color: var(--k-color-accent);
}

/* -----------------------------------------------------------------------------
   QUOTES / CODE / RULES baseline (component layers refine)
   ----------------------------------------------------------------------------- */
blockquote {
  quotes: "\201C" "\201D" "\2018" "\2019";
}

code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.92em;
}

hr {
  height: 0;
  margin: var(--k-space-lg) 0;
  border: 0;
  border-top: 1px solid var(--k-color-rule);
  color: inherit;
}

/* -----------------------------------------------------------------------------
   FORM CONTROL RESETS — inherit font, sane sizing, no UA chrome surprises.
   ----------------------------------------------------------------------------- */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
}

button,
select {
  text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  appearance: button;
  cursor: pointer;
  background-color: transparent;
  border: 0;
  color: inherit;
}

button:disabled,
[type="submit"]:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  overflow: auto;
}

input,
textarea,
select {
  background-color: var(--k-color-surface);
}

/* Remove inner UA spacing in Firefox. */
::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/* Search input UA appearance reset. */
[type="search"] {
  -webkit-appearance: textfield;
  appearance: textfield;
  outline-offset: -2px;
}

::-webkit-search-decoration {
  -webkit-appearance: none;
}

::placeholder {
  color: var(--k-color-faint);
  opacity: 1;
}

/* Native focus on file upload button. */
::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}

/* Tables baseline. */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* -----------------------------------------------------------------------------
   SELECTION — warm terracotta tint
   ----------------------------------------------------------------------------- */
::selection {
  background-color: var(--k-color-accent-soft-2);
  color: var(--k-color-accent-strong);
}

/* -----------------------------------------------------------------------------
   FOCUS — visible accent ring for keyboard users only.
   Mouse clicks (no :focus-visible) stay clean; keyboard always shows the ring.
   ----------------------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--k-color-accent);
  outline-offset: 2px;
  border-radius: var(--k-radius-xs);
}

/* Stronger ring (token) for interactive surfaces that opt in. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--k-color-accent);
  outline-offset: 2px;
  box-shadow: var(--k-shadow-focus);
}

/* -----------------------------------------------------------------------------
   SKIP LINK — visually hidden until focused, then accent chip top-left.
   ----------------------------------------------------------------------------- */
.k-skip-link {
  position: fixed;
  top: var(--k-space-2xs);
  left: var(--k-space-2xs);
  z-index: var(--k-z-skip);
  padding: var(--k-space-2xs) var(--k-space-sm);
  background-color: var(--k-color-accent);
  color: var(--k-color-on-accent);
  font-family: var(--k-font-sans);
  font-size: var(--k-fs-small);
  font-weight: var(--k-weight-semibold);
  border-radius: var(--k-radius-sm);
  box-shadow: var(--k-shadow-md);
  transform: translateY(calc(-100% - var(--k-space-md)));
  transition: transform var(--k-dur-fast) var(--k-ease-standard);
}

.k-skip-link:focus,
.k-skip-link:focus-visible {
  transform: translateY(0);
  color: var(--k-color-on-accent);
  outline: 2px solid var(--k-color-on-accent);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   VISUALLY HIDDEN — screen-reader-only (collapse, no layout cost).
   ----------------------------------------------------------------------------- */
.k-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* -----------------------------------------------------------------------------
   REDUCED MOTION — disable non-essential motion (tokens also neutralized).
   ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .k-skip-link {
    transition: none;
  }
}
