/*
 * This Yet That — app layer on the Understanding Workbench design system.
 * Load AFTER workbench.css (the canonical design-system.css, pasted verbatim).
 *
 * This file does two jobs:
 *   1. Maps the app's interactive chrome (forms, buttons, cards, header
 *      offsets) onto the system's semantic variables (--text-1, --wash-1,
 *      --line-1, the palette tokens). No literal colors except rgba washes
 *      of palette tokens, matching the system's own practice.
 *   2. Defines legacy alias tokens so page-specific CSS written against the
 *      earlier app vocabulary (--primary, --font-headline, --radius, …)
 *      resolves to workbench tokens. New page CSS should use the workbench
 *      names directly.
 */

:root {
  /* Legacy aliases → workbench tokens */
  --font-headline: var(--font-h2);
  --font-mono: var(--font-caption);
  --primary: var(--sky-deep);
  --primary-medium: var(--sky);
  --primary-light: rgba(70, 157, 198, 0.10);
  --primary-border: var(--sky-light);
  --text: var(--text-1);
  --text-muted: var(--text-2);
  --text-subtle: var(--mist);
  --line: var(--line-2);
  --card-bg: var(--wash-1);
  --bg: var(--paper);
  --breathe: var(--highlight);
  --eclipse: var(--ink);
  --eclipse-light: var(--mist);
  --shared-bg: rgba(27, 29, 24, 0.05);
  --green: var(--lime);
  --orange: var(--tangerine);
  --yellow: var(--gold);
  --them-subtle: rgba(70, 157, 198, 0.06);
  --work-primary: var(--sky-deep);
  --work-medium: var(--sky);
  --work-light: rgba(70, 157, 198, 0.10);
  --work-border: var(--sky-light);
  /* Sharp workbench chrome */
  --radius: 2px;
  --radius-lg: 3px;
}

/* ── App page frame ─────────────────────────────────────────────── */
/* App screens sit on paper; the fixed site-header needs an offset.  */
body.app-page { background: var(--paper); color: var(--text-1); }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 110px 24px 48px;
}

h2 {
  font-family: var(--font-h2);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-1);
  margin: 0 0 20px 0;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--wash-1);
  border: 1px solid var(--line-1);
  border-left: 3px solid var(--sky);
  border-radius: 2px;
  padding: 28px;
  margin-bottom: 24px;
}

/* ── Form controls ──────────────────────────────────────────────── */
label {
  display: block;
  font-family: var(--font-caption);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-2);
  margin-bottom: 7px;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="number"], textarea, select {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-1);
  background: var(--wash-1);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  margin-bottom: 18px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(70, 157, 198, 0.15);
}

/* ── Buttons (flat workbench chrome) ────────────────────────────── */
button { font-family: var(--font-caption); }

.btn-primary, .btn-create, .btn-new, .btn-fwd {
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font-caption);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover, .btn-create:hover, .btn-new:hover, .btn-fwd:hover { opacity: .85; }
.btn-primary:disabled, .btn-create:disabled, .btn-fwd:disabled {
  background: var(--mist);
  cursor: not-allowed;
  opacity: 1;
}

.btn-new { width: auto; margin-top: 24px; display: inline-block; }

.btn-back {
  padding: 14px 24px;
  font-family: var(--font-caption);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
}
.btn-back:hover { background: var(--shared-bg); }

.btn-add {
  width: 100%;
  padding: 12px;
  font-family: var(--font-caption);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: transparent;
  color: var(--sky-deep);
  border: 1px dashed var(--line-2);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 24px;
}
.btn-add:hover { background: var(--them-subtle); border-color: var(--sky); }

.btn-secondary {
  padding: 9px 14px;
  font-family: var(--font-caption);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--shared-bg); }

.btn-danger {
  padding: 9px 14px;
  font-family: var(--font-caption);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--highlight);
  border: 1px solid var(--highlight);
  border-radius: 2px;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(231, 30, 16, 0.06); }

.btn-small {
  padding: 6px 14px;
  font-family: var(--font-caption);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}
.btn-teal { background: var(--sky-deep); color: #fff; }
.btn-teal:hover { opacity: .85; }
.btn-outline { background: transparent; color: var(--sky-deep); border: 1px solid var(--sky); }
.btn-outline:hover { background: var(--them-subtle); }
.btn-success { background: var(--lime); color: var(--ink); }
.btn-success:hover { opacity: .9; }

.btn-copy {
  padding: 7px 14px;
  font-family: var(--font-caption);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  cursor: pointer;
}
.btn-copy:hover { background: var(--shared-bg); }

/* ── Token field ────────────────────────────────────────────────── */
.token-field { position: relative; margin-bottom: 18px; }
.token-field input { margin-bottom: 0 !important; padding-right: 78px; }
.token-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 6px 12px;
  font-family: var(--font-caption);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--text-2);
}
.token-toggle:hover { background: var(--shared-bg); }

/* ── Helper text & status ───────────────────────────────────────── */
.muted, .hint {
  font-family: var(--font-body);
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.55;
}
.hint { margin-top: -10px; margin-bottom: 16px; }
.error { color: var(--highlight); margin-top: 12px; font-family: var(--font-body); }

.status-msg {
  padding: 11px 14px;
  border-radius: 2px;
  border-left: 3px solid var(--line-2);
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-size: .9rem;
}
.status-success { background: rgba(166, 178, 40, 0.14); color: #65700c; border-left-color: var(--lime); }
.status-error { background: rgba(231, 30, 16, 0.07); color: var(--highlight); border-left-color: var(--highlight); }

/* ── Link rows ──────────────────────────────────────────────────── */
.links { display: grid; gap: 10px; font-family: var(--font-body); font-size: .9rem; }
.link-row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}
.link-row:first-child { border-top: 0; }
.link-label {
  font-family: var(--font-caption);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-2);
}
.link-url { color: var(--sky-deep); overflow-wrap: anywhere; }
.link-url:hover { color: var(--sky); }

/* ── App footer (site-footer idiom) ─────────────────────────────── */
.app-footer {
  padding: 24px 48px;
  background: var(--paper);
  border-top: 1px solid rgba(27, 29, 24, 0.1);
  text-align: center;
  font-family: var(--font-cite);
  font-size: .78rem;
  color: var(--mist);
}
.app-footer a { color: var(--mist); text-decoration: none; }
.app-footer a:hover { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 700px) {
  .main { padding: 96px 18px 40px; }
  .link-row { grid-template-columns: 1fr; }
}

.header-meta {
  font-family: var(--font-caption);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--mist);
}
