/* Calling Codes base: the paper, ink and type the label shares with its apps.
   Ink only. Each app brings its own accent (Fivebars: signal red). */

/* Calling Code by Ryoichi Tsunekawa (Dharma Type), the brand face: names, labels, addresses, metadata.
   One weight, so hierarchy comes from size and ink, never faux bold. Latin-1 subset, self-hosted.
   IBM Plex Sans (self-hosted) carries running text: a calm grotesque from a family drawn with a mono sibling, so it
   reads as the same hand at sentence length. */
@font-face {
  font-family: "Calling Code";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/calling-code-regular.woff2?v=1c8f65f3db") format("woff2");
}
/* IBM Plex Sans (SIL OFL), Latin subset, self-hosted: the three weights the pages use. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-400.woff2?v=b947749baa") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-500.woff2?v=386db54484") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-600.woff2?v=4cfc3c246e") format("woff2");
}
/* Arial scaled to Plex Sans' width and 1.025/0.275 ascent/descent. */
@font-face {
  font-family: "IBM Plex Sans Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 101%;
  ascent-override: 101.5%;
  descent-override: 27.2%;
  line-gap-override: 0%;
}
/* Menlo/Courier scaled to Calling Code's 0.56em advance and 0.95/0.30 ascent/descent, so the swap barely moves. */
@font-face {
  font-family: "Calling Code Fallback";
  src: local("Menlo"), local("DejaVu Sans Mono"), local("Courier New");
  size-adjust: 93%;
  ascent-override: 102%;
  descent-override: 32%;
  line-gap-override: 0%;
}

:root {
  --paper: #f2ede2;
  --paper-2: #e8e1d2;
  --ink: #18203a;
  --ink-2: #4a5169;
  --rule: rgba(24, 32, 58, 0.18);
  --rule-strong: rgba(24, 32, 58, 0.42);
  --key-off: rgba(24, 32, 58, 0.16);
  --shadow: 0 1px 2px rgba(24, 32, 58, 0.12), 0 24px 48px -16px rgba(24, 32, 58, 0.35);
  --brand: "Calling Code", "Calling Code Fallback", ui-monospace, monospace;
  --sans: "IBM Plex Sans", "IBM Plex Sans Fallback", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10131c;
    --paper-2: #181c28;
    --ink: #ece6d8;
    --ink-2: #a9adbd;
    --rule: rgba(236, 230, 216, 0.16);
    --rule-strong: rgba(236, 230, 216, 0.4);
    --key-off: rgba(236, 230, 216, 0.16);
    --shadow: 0 0 0 1px rgba(236, 230, 216, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #10131c;
  --paper-2: #181c28;
  --ink: #ece6d8;
  --ink-2: #a9adbd;
  --rule: rgba(236, 230, 216, 0.16);
  --rule-strong: rgba(236, 230, 216, 0.4);
  --key-off: rgba(236, 230, 216, 0.16);
  --shadow: 0 0 0 1px rgba(236, 230, 216, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scrollbar-color: var(--rule-strong) var(--paper); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
  overflow-x: clip;
}

::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; text-wrap: balance; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--ink); color: var(--paper); padding: 8px 12px; }

/* Keypad mark: twelve keys, three by four, like the phone you dial a country code on. */
.keypad { width: 20px; height: 26px; flex: none; }
.keypad rect { fill: currentColor; transform-box: fill-box; transform-origin: center; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 400 1.45rem/1 var(--brand); letter-spacing: -0.02em; white-space: nowrap; }
.wordmark:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); font-size: 0.95rem; font-weight: 500; }
.nav a { text-decoration: none; padding: 10px 0; }
.nav a:hover { text-decoration: underline; }
.theme { appearance: none; border: 1px solid var(--rule); background: transparent; color: var(--ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; transition: border-color 140ms ease-out; }
.theme:hover { border-color: var(--ink); }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.theme .fill { fill: currentColor; stroke: none; }

/* Footer */
.foot { border-top: 1.5px solid var(--ink); padding: 28px 0 44px; font-size: 0.9rem; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 32px; }
.foot-brand { display: inline-flex; align-items: center; gap: 10px; font: 400 1.05rem/1 var(--brand); letter-spacing: -0.01em; }
.foot-brand .keypad { width: 15px; height: 20px; }
.foot-credit { color: var(--ink-2); font-size: 0.85rem; text-decoration: none; padding: 8px 0; margin-right: auto; }
.foot-credit:hover { color: var(--ink); text-decoration: underline; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-weight: 500; }
.foot-links a { text-decoration: none; padding: 8px 0; }
.foot-links a:hover { text-decoration: underline; }
.foot-note { flex-basis: 100%; margin: 0; color: var(--ink-2); }
.foot-email { margin: 0; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--ink-2); }
.foot-email .email-text { font-weight: 500; color: var(--ink); }

/* Obfuscated email: the address is assembled by email.js on click, never written in the source. */
.email-text { white-space: nowrap; font-weight: 600; }
.email-sep { display: inline-block; margin: 0 0.05em; padding: 0 0.35em; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink-2); font: 400 0.78em/1.5 var(--brand); letter-spacing: 0; vertical-align: 0.08em; }
.email-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
.email-btn { appearance: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--rule-strong); border-radius: 999px; background: transparent; color: var(--ink); font: 400 0.82rem/1 var(--brand); cursor: pointer; transition: border-color 140ms ease-out, background-color 140ms ease-out, color 140ms ease-out; }
.email-btn:hover { border-color: var(--ink); }
.email-btn[data-done] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.email-status { font: 400 0.82rem/1.4 var(--brand); color: var(--ink-2); }
.email-actions.compact { display: inline-flex; margin: 0; gap: 8px; }
.email-actions.compact .email-btn { min-height: 28px; padding: 0 10px; font-size: 0.72rem; border-color: var(--rule); color: var(--ink-2); }
.email-actions.compact .email-btn:hover { color: var(--ink); border-color: var(--ink); }
.email-actions.compact .email-status { font-size: 0.72rem; }
@media (prefers-reduced-motion: reduce) { .email-btn, .theme { transition: none; } }

/* Plain document pages (legal, 404) */
.doc > * { max-width: 760px; }
.doc { padding-top: clamp(32px, 6vw, 72px); padding-bottom: clamp(64px, 9vw, 112px); }
.doc h1 { font: 400 clamp(2.4rem, 6vw, 4rem)/1.05 var(--brand); letter-spacing: -0.03em; margin-bottom: 20px; }
.doc-lede { font-size: 1.25rem; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 600px) {
  .nav { gap: 14px; font-size: 0.9rem; }
  .wordmark { font-size: 1.25rem; gap: 10px; }
}

.legal { margin: 40px 0 0; border-top: 3px solid var(--ink); }
.legal div { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.legal dt { font: 400 0.82rem/1.6 var(--brand); color: var(--ink-2); padding-top: 0.15em; }
.legal dd { margin: 0; }
.legal .email-actions.compact { margin-left: 10px; vertical-align: 0.1em; }
.lost { list-style: none; margin: 40px 0 0; padding: 0; border-top: 3px solid var(--ink); }
.lost li { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.lost a { font: 400 1.6rem/1.1 var(--brand); letter-spacing: -0.02em; text-decoration: none; width: max-content; }
.lost a:hover { text-decoration: underline; }
.lost span { color: var(--ink-2); }

@media (max-width: 600px) {
  .legal div { grid-template-columns: 1fr; }
}
