/* twomarmots — component styles. Load after tokens.css. Every colour, size and space comes from a token. */

/* ---------- Type ---------- */
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 24px;
  font-feature-settings: "kern" 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, .tm-display { font-family: var(--font-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 50, "WONK" 0; font-weight: 500; color: var(--ink); margin: 0; text-wrap: balance; }
h1 { font-size: 34px; line-height: 40px; letter-spacing: -0.015em; }
h2 { font-size: 22px; line-height: 28px; font-weight: 560; letter-spacing: -0.01em; }
p, li { text-wrap: pretty; hanging-punctuation: first; }
.tm-num, .tm-progress-label, .tm-count { font-variant-numeric: tabular-nums; }
.tm-caps { font: 600 12px/16px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; }
.tm-pad { padding: var(--space-5); }
.tm-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.tm-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.tm-muted { color: var(--ink-muted); }
a, .tm-link { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
a:hover, .tm-link:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--brand-soft); }

/* ---------- Masthead ---------- */
.tm-masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.tm-masthead-inner { max-width: var(--page-max); margin: 0 auto; padding: var(--space-4) var(--space-5); display: flex; align-items: center; gap: var(--space-7); }
.tm-wordmark { font-family: var(--font-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 100, "WONK" 0; font-weight: 600; font-size: 24px; line-height: 28px; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; color: var(--ink); }
.tm-wordmark .two { color: var(--brand); } .tm-wordmark .marmots { color: var(--ink); }
.tm-nav { display: flex; gap: var(--space-5); flex: 1; }
.tm-nav a { color: var(--ink-muted); text-decoration: none; font-weight: 500; font-size: 15px; padding: var(--space-1) 0; border-bottom: 1.5px solid transparent; }
.tm-nav a:hover { color: var(--ink); }
.tm-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.tm-masthead-aside { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; color: var(--ink-muted); }

/* ---------- Button ---------- */
.tm-btn { font: 600 15px/20px var(--font-body); letter-spacing: 0.005em; height: 40px; padding: 0 var(--space-5); border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); white-space: nowrap; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease; }
.tm-btn:hover { border-color: var(--ink); }
.tm-btn:active { background: var(--surface-sunk); }
.tm-btn-primary { border-color: var(--brand-press); background: var(--brand); color: var(--on-brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.tm-btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-press); }
.tm-btn-primary:active { background: var(--brand-press); }
.tm-btn-danger { border-color: var(--error); color: var(--error); }
.tm-btn-danger:hover { border-color: var(--error); background: var(--error-soft); }
.tm-btn-sm { height: 32px; padding: 0 var(--space-4); font-size: 14px; }
.tm-btn-lg { height: 48px; padding: 0 var(--space-6); font-size: 16px; }
.tm-btn[disabled], .tm-btn[aria-disabled="true"] { cursor: default; color: var(--ink-muted); border-color: var(--line); background: var(--surface-sunk); box-shadow: none; pointer-events: none; }
.tm-or { color: var(--ink-muted); font-size: 14px; }

/* ---------- Box ---------- */
.tm-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tm-box-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-5) 0; }
.tm-box-title { margin: 0; font-family: var(--font-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 50, "WONK" 0; font-weight: 560; font-size: 22px; line-height: 28px; letter-spacing: -0.01em; }
.tm-box-action { font-size: 14px; }
.tm-box-body { padding: var(--space-4) var(--space-5) var(--space-5); }
.tm-box-sunk { background: var(--surface-sunk); border-color: transparent; }

/* ---------- Tabs ---------- */
.tm-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); padding: 0 var(--space-4); }
.tm-tab { font: 600 14px/20px var(--font-body); color: var(--ink-muted); background: var(--surface-sunk); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-md) var(--radius-md) 0 0; padding: var(--space-2) var(--space-4); margin-bottom: -1px; cursor: pointer; }
.tm-tab:hover { color: var(--ink); }
.tm-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--surface); box-shadow: inset 0 2px 0 var(--brand); }

/* ---------- Field ---------- */
.tm-field { display: flex; flex-direction: column; gap: var(--space-2); }
.tm-label { font: 600 14px/20px var(--font-body); color: var(--ink); }
.tm-input { font: 400 16px/24px var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); box-shadow: var(--shadow-inset); min-height: 44px; box-sizing: border-box; width: 100%; }
.tm-input::placeholder { color: var(--ink-muted); opacity: 1; }
.tm-input:hover { border-color: var(--ink-muted); }
.tm-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
select.tm-input { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111111' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
textarea.tm-input { min-height: 96px; resize: vertical; }
input[type="file"].tm-input { padding: var(--space-2); font-size: 14px; }
.tm-help { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.tm-field-error .tm-input { border-color: var(--error); }
.tm-field-error .tm-help { color: var(--error); }

/* ---------- Checklist ---------- */
.tm-list { list-style: none; margin: 0; padding: 0; }
.tm-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); border-radius: var(--radius-sm); transition: background-color 1.6s ease-out; }
.tm-item:last-child { border-bottom: 0; }
.tm-item:hover { background: var(--surface-hover); }
.tm-check { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; display: grid; place-content: center; transition: background-color 120ms ease, border-color 120ms ease; }
.tm-check:hover { border-color: var(--ink); }
.tm-check:checked { background: var(--brand); border-color: var(--brand); }
.tm-check:checked::after { content: ""; width: 10px; height: 5px; border-left: 2px solid var(--on-brand); border-bottom: 2px solid var(--on-brand); transform: translateY(-1px) rotate(-45deg); }
.tm-item-text { flex: 1; min-width: 0; }
.tm-item-title { display: block; }
.tm-item-meta { display: block; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.tm-item-done .tm-item-title { color: var(--ink-muted); text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: var(--ink-muted); }

/* ---------- The fade (the 2005 classic, in cranberry instead of yellow) ---------- */
@keyframes tm-fade { from { background-color: var(--fade); } to { background-color: transparent; } }
.tm-fade { animation: tm-fade 1.6s ease-out 1; }
@media (prefers-reduced-motion: reduce) { .tm-fade { animation: none; outline: 2px solid var(--brand-soft); outline-offset: -2px; } }

/* ---------- Inline add ---------- */
.tm-add-link { display: inline-flex; align-items: center; gap: var(--space-2); font: 600 15px/20px var(--font-body); color: var(--brand); text-decoration: none; padding: var(--space-2); background: none; border: 0; cursor: pointer; }
.tm-add-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tm-add-plus { width: 20px; height: 20px; border-radius: var(--radius-pill); border: 1.5px solid currentColor; display: grid; place-content: center; font-size: 14px; line-height: 1; }
.tm-add-form { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); background: var(--surface-sunk); border-radius: var(--radius-md); }

/* ---------- Notice ---------- */
.tm-notice { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunk); color: var(--ink); font-size: 15px; line-height: 22px; }
.tm-notice b { font-weight: 650; }
.tm-notice-success { background: var(--brand-soft); }
.tm-notice-success b { color: var(--brand); }
.tm-notice-info { background: var(--navy-soft); }
.tm-notice-info b { color: var(--navy); }
.tm-notice-error { background: var(--error-soft); }
.tm-notice-error b { color: var(--error); }
.tm-notice-close { margin-left: auto; font-size: 14px; }

/* ---------- Tag ---------- */
.tm-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tm-tag { display: inline-flex; align-items: center; font: 500 13px/22px var(--font-body); color: var(--ink-muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0 var(--space-3); text-decoration: none; }
a.tm-tag:hover { color: var(--ink); border-color: var(--line-strong); }
.tm-tag[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }

/* ---------- Owner ---------- */
.tm-owner { display: inline-flex; align-items: center; gap: var(--space-2); font: 600 14px/20px var(--font-body); color: var(--ink); }
.tm-owner-dot { width: 24px; height: 24px; border-radius: var(--radius-pill); color: var(--on-brand); display: grid; place-content: center; font: 650 11px/1 var(--font-body); letter-spacing: 0.02em; flex: none; }
.tm-owner-dot.a { background: var(--owner-a); } .tm-owner-dot.b { background: var(--owner-b); }
.tm-owner-dot.both { background: linear-gradient(90deg, var(--owner-a) 50%, var(--owner-b) 50%); }
.tm-owner-sm .tm-owner-dot { width: 20px; height: 20px; font-size: 10px; }

/* ---------- Photo ---------- */
.tm-photo { display: inline-flex; flex-direction: column; gap: var(--space-2); margin: 0; }
.tm-photo-frame { display: block; background: var(--surface); padding: 4px; border-radius: var(--radius-xl); box-shadow: var(--shadow-photo); }
.tm-photo-frame img, .tm-photo-empty { display: block; border-radius: calc(var(--radius-xl) - 4px); object-fit: cover; }
.tm-photo-empty { background: var(--photo-bg); color: var(--ink-muted); display: grid; place-content: center; font: 600 12px/16px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }
.tm-photo-round .tm-photo-frame, .tm-photo-round img, .tm-photo-round .tm-photo-empty { border-radius: var(--radius-pill); }
.tm-photo figcaption { font: italic 400 14px/20px var(--font-display); color: var(--ink-muted); text-align: center; }
.tm-photo-credit { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---------- Sticker ---------- */
.tm-sticker { display: inline-grid; place-content: center; width: 52px; height: 52px; background: var(--navy); color: var(--on-brand); font: italic 600 13px/1 var(--font-display); transform: rotate(-12deg);
  clip-path: polygon(50% 0%, 61% 12%, 77% 7%, 80% 23%, 95% 28%, 89% 43%, 100% 55%, 87% 65%, 90% 81%, 74% 83%, 66% 98%, 52% 89%, 38% 98%, 30% 83%, 14% 83%, 15% 66%, 2% 56%, 12% 43%, 5% 28%, 21% 23%, 24% 7%, 40% 12%); }

/* ---------- Progress ---------- */
.tm-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.tm-progress-track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunk); overflow: hidden; }
.tm-progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand); transition: width 240ms ease; }
.tm-progress-label { display: flex; justify-content: space-between; font-size: 13px; line-height: 20px; color: var(--ink-muted); }

/* ---------- Empty state ---------- */
.tm-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-4); padding: var(--space-8) var(--space-5); }
.tm-empty h3 { margin: 0; font-family: var(--font-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 50, "WONK" 0; font-weight: 500; font-size: 24px; line-height: 30px; }
.tm-empty p { margin: 0; max-width: 420px; font-size: 17px; line-height: 26px; color: var(--ink-muted); }

/* =====================================================================
   Depth: the Web 2.0 layer. Gloss is an overlay on top of a token colour,
   so every fill keeps its exact hue: a light sheen on top, a hair of
   shade at the bottom. Quiet, never glassy.
   ===================================================================== */
:root {
  --gloss: linear-gradient(to bottom, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0.06) 50%, rgba(0, 0, 0, 0) 51%, rgba(0, 0, 0, 0.08) 100%);
  --sheen: linear-gradient(to bottom, #ffffff 0%, #f6f2ee 100%);
  --sheen-hover: linear-gradient(to bottom, #ffffff 0%, #efe9e3 100%);
}
.tm-masthead { background: var(--sheen); box-shadow: inset 0 3px 0 var(--brand), inset 0 4px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(60, 40, 30, 0.06); }
.tm-box { box-shadow: var(--shadow-box); }
.tm-box-head { border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; }
.tm-box-sunk { box-shadow: var(--shadow-inset); }

.tm-btn { background: var(--sheen); box-shadow: var(--shadow-button); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); }
.tm-btn:hover { background: var(--sheen-hover); }
.tm-btn:active { background: var(--surface-sunk); box-shadow: var(--shadow-pressed); }
.tm-btn-primary { background: var(--gloss), var(--brand); box-shadow: var(--shadow-button-fill); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); }
.tm-btn-primary:hover { background: var(--gloss), var(--brand-hover); }
.tm-btn-primary:active { background: var(--brand-press); box-shadow: var(--shadow-pressed); }
.tm-btn-danger { background: var(--sheen); }
.tm-btn[disabled], .tm-btn[aria-disabled="true"] { background: var(--surface-sunk); box-shadow: none; text-shadow: none; }

.tm-input { box-shadow: var(--shadow-inset); }
select.tm-input { background-color: var(--surface); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111111' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), var(--sheen); background-repeat: no-repeat, no-repeat; background-position: right 14px center, 0 0; box-shadow: var(--shadow-button); }

.tm-check { box-shadow: var(--shadow-inset); }
.tm-check:checked { background: var(--gloss), var(--brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 1px rgba(40, 10, 20, 0.25); }

.tm-tab { background: linear-gradient(to bottom, #f7f4f1, #ece6e0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.tm-tab[aria-selected="true"] { background: var(--surface); box-shadow: inset 0 2px 0 var(--brand); }

.tm-owner-dot { background-image: var(--gloss); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 1px rgba(0, 0, 0, 0.2); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); }
.tm-owner-dot.both { background-image: var(--gloss), linear-gradient(90deg, var(--owner-a) 50%, var(--owner-b) 50%); }

.tm-notice { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 1px rgba(60, 40, 30, 0.05); border: 1px solid rgba(60, 40, 30, 0.08); }

.tm-tag { background: var(--sheen); box-shadow: var(--shadow-button); }

.tm-progress-track { height: 12px; background: var(--surface-sunk); box-shadow: var(--shadow-inset); border: 1px solid var(--line); }
.tm-progress-fill { background: var(--gloss), var(--brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }

.tm-sticker { background: var(--gloss), var(--navy); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); }
.tm-add-form { box-shadow: var(--shadow-inset); }
.tm-owner-dot.a { background-color: var(--owner-a); background-image: var(--gloss); }
.tm-owner-dot.b { background-color: var(--owner-b); background-image: var(--gloss); }
input[type="file"].tm-input { box-shadow: none; border-style: dashed; padding: var(--space-2); color: var(--ink-muted); }
input[type="file"]::file-selector-button { font: 600 14px/20px var(--font-body); height: 32px; padding: 0 var(--space-4); margin-right: var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--sheen); box-shadow: var(--shadow-button); color: var(--ink); cursor: pointer; }

/* ---------- patterns: fixed header, list search, quantities ---------- */
.tm-masthead { position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line), 0 6px 18px -12px rgba(17, 17, 17, .25); }
.list-filter { width: 100%; padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6560' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") 12px 50% / 16px no-repeat; }
.item-qty { margin-left: var(--space-1); color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
