/* Kraft & Carbon, for the web.
 *
 * The app's design language, ported for the public site. Every colour below is a
 * literal transcription of a token in
 * app/src/main/java/si/vstaric/tolar/ui/theme/KraftColors.kt, and the custom
 * property names are the ones that file names in its comments — so the two can be
 * diffed by eye and neither drifts silently. Do NOT invent shades here; a new
 * colour goes into the app's palette first.
 *
 * Type roles come from ui/theme/KraftType.kt. The Type Guide states the iOS pt
 * baseline maps 1:1 to Android sp, and it maps 1:1 to CSS px here for the same
 * reason. Tracking stays in `em` so it scales with size instead of drifting.
 *
 * Nothing here loads from a third party. The faces are served from this origin.
 */

/* ---- the three families, subset and served from this origin ---------------
 *
 * Same faces the app bundles (app/src/main/res/font), subset to Latin +
 * Latin Extended-A + the punctuation these pages use, and repacked as woff2.
 * See ../README.md for the exact command. Licence: fonts/OFL-1.1.txt.
 *
 * Only the weights the ramp actually uses are here: Oswald 600/700 (Title, Nav,
 * SectionLabel, FieldLabel / Display), Space Mono 400/700/400-italic, Kalam 400.
 *
 * Note: neither Oswald nor Kalam carries U+2192 (→). Arrows belong in Space Mono
 * text only.
 */
@font-face {
  font-family: "Kraft Stencil";
  src: url("fonts/oswald-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Kraft Stencil";
  src: url("fonts/oswald-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Kraft Mono";
  src: url("fonts/space-mono-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Kraft Mono";
  src: url("fonts/space-mono-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Kraft Mono";
  src: url("fonts/space-mono-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Kraft Marker";
  src: url("fonts/kalam-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* surfaces (kraft stock) */
  --desk: #a98a58;
  --kraft: #c8ab79;
  --kraft-2: #d3b98c;
  --manila: #e0cda4;
  --manila-hi: #ece0c2;
  --chip: #b8996a;

  /* ink */
  --ink: #2a2116;
  --ink-soft: #54432a;
  --ink-faint: #8a7048;
  --pencil: #a98d5f;

  /* lines / hardware */
  --rule: #7a5c30;
  --edge: #9a7c4c;
  --edge-soft: #b39a6c;
  --metal: #8f8674;
  --twine: #b39463;
  --hair: rgba(60, 44, 22, 0.16);

  /* ink-pad accents */
  --stamp-red: #b0381f;
  --ink-blue: #2f4f6e;
  --field-green: #5b6b39;
  --ochre: #c0862b;
  --on-stamp: #f6e6d8;
  --on-ink-blue: #eaf0f5;

  /* texture tints — the grain and fibre Modifier.kraftPaper tiles in the app */
  --grain: rgba(74, 48, 16, 0.13);
  --fiber: rgba(120, 88, 42, 0.05);
  --shadow-ambient: rgba(48, 32, 14, 0.14);
  --shadow-cast: rgba(48, 32, 14, 0.2);

  /* Kraft & Carbon is a paper stock. It has no dark scheme, and the two screens
   * in the app that get dark tokens are a camera viewfinder and a full-bleed
   * photo — neither of which exists here. So the page declares `light` and does
   * not offer a dark variant it would have to invent. */
  color-scheme: light;
}

/* ---- page ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  padding: 0;
  background-color: var(--desk);
  color: var(--ink);
  font-family: "Kraft Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 24px;
  /* The paper grain, as two tiled gradients rather than an image file: one
   * speckle, one 30° fibre streak. Same two tints Modifier.kraftPaper uses. */
  background-image:
    repeating-linear-gradient(30deg, var(--fiber) 0 2px, transparent 2px 7px),
    radial-gradient(var(--grain) 0.6px, transparent 0.7px);
  background-size: auto, 5px 5px;
}

.sheet {
  max-width: 46rem;
  margin: 0 auto;
  background-color: var(--kraft);
  background-image:
    repeating-linear-gradient(30deg, var(--fiber) 0 2px, transparent 2px 7px),
    radial-gradient(var(--grain) 0.6px, transparent 0.7px);
  background-size: auto, 5px 5px;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  box-shadow: 0 0 24px var(--shadow-ambient);
  padding: 0 1.5rem 4rem;
}

@media (max-width: 34rem) {
  .sheet {
    padding: 0 1.1rem 3rem;
  }
}

/* ---- skip link ----------------------------------------------------------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--stamp-red);
  color: var(--on-stamp);
  padding: 0.5rem 0.9rem;
  border-radius: 2px;
}

/* ---- masthead + nav ------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px dashed var(--rule);
}

.masthead__mark {
  width: 44px;
  height: 44px;
  flex: none;
}

.masthead__word {
  font-family: "Kraft Stencil", "Arial Narrow", Arial, sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0;
}

.masthead__word a {
  color: var(--ink);
  text-decoration: none;
}

.masthead__tag {
  /* KraftType.Caption */
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-soft);
  margin-left: auto;
  text-align: right;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--hair);
}

.nav a {
  /* KraftType.Nav */
  font-family: "Kraft Stencil", "Arial Narrow", Arial, sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 3px solid var(--stamp-red);
}

/* ---- type ramp ----------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: "Kraft Stencil", "Arial Narrow", Arial, sans-serif;
  text-transform: uppercase;
  margin: 0;
}

/* KraftType.Display */
h1 {
  font-weight: 700;
  font-size: 52px;
  line-height: 48px;
  letter-spacing: 0.03em;
  margin: 2rem 0 1rem;
}

@media (max-width: 34rem) {
  h1 {
    font-size: 38px;
    line-height: 38px;
  }
}

/* KraftType.Title */
h2 {
  font-weight: 600;
  font-size: 23px;
  line-height: 28px;
  letter-spacing: 0.06em;
  margin: 2.5rem 0 0.75rem;
}

/* KraftType.SectionLabel */
h3 {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  margin: 1.5rem 0 0.35rem;
}

p {
  margin: 0 0 1rem;
}

strong {
  font-weight: 700;
}

/* KraftType.Accent — the grease-pencil margin note. Footnote apparatus and
 * asides ONLY, one per screen at most, exactly as the app uses it. */
.note {
  font-family: "Kraft Marker", "Comic Sans MS", cursive;
  font-size: 22px;
  line-height: 30px;
  color: var(--rule);
  margin: 1.25rem 0;
}

.caption {
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-soft);
}

/* The lead paragraph on each page. */
.lead {
  font-size: 18px;
  line-height: 30px;
}

a {
  color: var(--stamp-red);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  color: var(--ink-blue);
}

/* ---- the stamped claim --------------------------------------------------- */

.stamp {
  display: inline-block;
  border: 3px solid var(--stamp-red);
  color: var(--stamp-red);
  font-family: "Kraft Stencil", "Arial Narrow", Arial, sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border-radius: 3px;
  transform: rotate(-2.5deg);
  margin: 0.5rem 0 1.5rem;
}

/* ---- cards / panels ------------------------------------------------------ */

.panel {
  background: var(--kraft-2);
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  box-shadow: 0 1px 2px var(--shadow-cast);
}

.panel--label {
  background: var(--manila);
}

.panel h3 {
  margin-top: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

/* A row of feature panels that collapses to one column on a phone. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.grid .panel {
  margin: 0;
}

/* ---- toggle rows: the two optional features ------------------------------ */

.toggle {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--rule);
}

.toggle:last-child {
  border-bottom: none;
}

.toggle__state {
  flex: none;
  font-family: "Kraft Stencil", "Arial Narrow", Arial, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--chip);
  color: var(--manila-hi);
  border-radius: 2px;
  padding: 0.2rem 0.5rem;
  margin-top: 0.3rem;
}

.toggle__body > :last-child {
  margin-bottom: 0;
}

/* ---- lists --------------------------------------------------------------- */

ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

li {
  margin-bottom: 0.35rem;
}

li::marker {
  color: var(--rule);
}

/* ---- rules --------------------------------------------------------------- */

hr {
  border: none;
  border-top: 1px dashed var(--rule);
  margin: 2.5rem 0;
}

/* ---- footer -------------------------------------------------------------- */

.foot {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hair);
  font-size: 11px;
  line-height: 18px;
  color: var(--ink-soft);
}

.foot a {
  color: var(--ink-soft);
}

.foot a:hover,
.foot a:focus {
  color: var(--ink);
}

/* ---- misc ---------------------------------------------------------------- */

code,
.mono-data {
  font-family: "Kraft Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* KraftType.Data — the widest tracking in the system, for codes. */
.mono-data {
  font-size: 18px;
  letter-spacing: 0.2em;
}

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

@media (prefers-reduced-motion: reduce) {
  .stamp {
    transform: none;
  }
}
