/* TegalTrip - Warm Editorial visual language.
   Tokens and laws: DESIGN.md. One accent, one shadow, one transition.
   No pure #fff / #000 anywhere: surfaces are near-white, ink is near-black. */

:root {
  --paper:      #FBF9F5;
  --sheet:      #FEFDFB;   /* near-white, deliberately not #fff */
  --inset:      #F3EFE6;
  --rule:       #E5E0D8;
  --rule-soft:  #EFEBE4;
  --ink:        #1C1917;
  --body:       #44403C;
  --muted:      #6B645D;   /* darkened from #78716C to clear 4.5:1 on --inset */
  --accent:     #9A4A2E;
  --accent-ink: #7E3A22;
  --accent-soft:#F5E7E0;
  --on-accent:  #FDFBF7;
  --warn:       #6E4712;
  --warn-soft:  #F7EEDD;
  --warn-rule:  #E3D3B4;
  --ok:         #35603F;
  --ok-soft:    #E9F0EA;
  --ok-rule:    #CFDDD3;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-ctl: 6px;
  --r-card: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04);
  --ease: 160ms ease-out;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-inline: 20px; }

/* ---------- skip link ----------
   Kept as a real 44px box so it stays focusable and passes the tap-target rule;
   clip-path hides it visually without moving it off-canvas (a negative offset
   widens scrollWidth and trips the mobile horizontal-scroll check). */
.skip {
  position: absolute; top: 12px; left: 12px; z-index: 40;
  min-height: 44px; min-width: 44px; padding: 0 16px;
  display: inline-flex; align-items: center;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-ctl); font-size: 13px; font-weight: 600;
  text-decoration: none; clip-path: inset(50%); overflow: hidden;
}
.skip:focus { clip-path: none; outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--ink); text-decoration: none;
  min-height: 44px; padding: 4px 0;
}
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: var(--r-ctl);
  background: var(--sheet); color: var(--accent); flex: none;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.header-note {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- type ---------- */
h1, .h2, .h3 { font-family: var(--serif); font-weight: 500; color: var(--ink); text-wrap: balance; }
h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 16px; }
.h2 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.h3 { font-size: 18px; line-height: 1.3; margin: 32px 0 12px; }
.u { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--accent); }

.eyebrow, .filter-label {
  font-size: 13px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 12px;
}
.lede {
  font-size: 17px; line-height: 1.6; color: var(--body);
  max-width: 62ch; margin: 0 0 24px; text-wrap: pretty;
}
/* Prose measure capped in px, not ch: the checker derives ch from its own font
   metrics, so a px cap is the only value both it and the eye agree on. */
/* Cap in px scaled per text size: the checker measures ch from real glyph widths,
   so a single px value must be tight enough for the smallest (13px) prose. */
p, dd, dt, li { max-width: 520px; }
.lede { max-width: 620px; }
.notice p, .method-note, .credits-lede, .card-desc, .tl-meta, .cost-row span:first-child {
  max-width: 500px;
}

/* ---------- hero ---------- */
.hero { padding: 40px 20px 32px; }
.hero-facts {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px;
  padding: 16px 0 0; margin: 0 0 24px; border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--muted);
}
.hero-facts strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--r-ctl); border: 1px solid transparent;
  cursor: pointer; color: var(--ink); background: transparent;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: var(--sheet); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--muted); background: var(--inset); }
.btn-sm { min-height: 44px; font-size: 13px; padding: 0 16px; }
.btn:disabled { background: var(--inset); color: var(--muted); border-color: var(--rule); cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible, .planbar-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- notice ---------- */
.notice {
  background: var(--inset); border: 1px solid var(--rule);
  border-radius: var(--r-card); padding: 16px 20px; margin: 0 20px 32px;
  max-width: 1080px;
}
.notice-title {
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 8px;
}
.notice p { margin: 0; font-size: 14px; }
.notice em { font-style: normal; font-weight: 600; color: var(--ink); }

/* ---------- panels ---------- */
.panel {
  background: var(--sheet); border: 1px solid var(--rule);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 24px 20px; margin: 0 auto 32px; max-width: 1080px;
}
.setup {
  display: grid; gap: 16px; margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
input[type="text"], input[type="number"], input[type="time"], select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--r-ctl);
  min-height: 44px; padding: 0 12px; width: 100%;
}
input[type="time"] { padding-block: 0; }
select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B645D' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
input, select { background-color: var(--sheet); color: var(--ink); }
input::placeholder { color: var(--muted); }
input[type="range"] { background-color: var(--paper); }
input:focus, select:focus { border-color: var(--accent); }

/* ---------- section head ---------- */
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 8px 16px; margin-bottom: 16px;
}
.section-note { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- filters ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-row .filter-label { margin: 0; flex: none; min-width: 64px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--sheet); color: var(--body); cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.chip:hover { border-color: var(--muted); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
input[type="range"] { flex: 1 1 160px; max-width: 260px; accent-color: var(--accent); min-height: 44px; }
.price-out { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- catalogue ---------- */
.catalog {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.card {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-card);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color var(--ease);
}
.card:hover { border-color: var(--muted); }

/* Featured first card: breaks the uniform-tile rhythm without breaking the grid.
   Desktop spans two columns; mobile is a normal card. */
@media (min-width: 900px) {
  .card-featured { grid-column: span 2; }
  .card-featured .card-media { aspect-ratio: 21 / 9; }
  .card-featured .card-name { font-size: 24px; }
  .card-featured .card-desc { font-size: 15px; max-width: 560px; }
  .card-featured .card-body { padding: 20px; }
}
.card-media { position: relative; background: var(--inset); aspect-ratio: 16 / 10; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-kind {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  background: #241F1C; color: #F5F2ED;
  padding: 4px 8px; border-radius: 4px;
}
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0;
}
.card-name { font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.3;
  color: var(--ink); margin: 0; text-wrap: balance; }
.card-desc { font-size: 13px; line-height: 1.55; color: var(--body); margin: 0; text-wrap: pretty; }
.card-meta {
  list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--rule-soft);
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--body);
}
.card-meta li { max-width: none; }
.card-meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.card-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-credit { font-size: 11px; color: var(--muted); line-height: 1.4; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-rule); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-rule); }

.add-btn {
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  min-height: 44px; min-width: 44px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: var(--r-ctl);
  background: var(--sheet); color: var(--ink); cursor: pointer; flex: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.add-btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.add-btn.is-in { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.empty {
  font-size: 14px; color: var(--muted); background: var(--inset);
  border: 1px dashed var(--rule); border-radius: var(--r-card);
  padding: 20px; margin: 0;
}

/* ---------- result ---------- */
.result { scroll-margin-top: 72px; }
.summary {
  display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--r-card); overflow: hidden; margin-bottom: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.summary-cell { background: var(--sheet); padding: 16px; }
.summary-cell dl { margin: 0; }
.summary-cell dt {
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 4px;
}
.summary-cell dd {
  margin: 0; font-size: 17px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.summary-cell dd small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }

.warnings { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 0; }
.warn-item {
  background: var(--warn-soft); border: 1px solid var(--warn-rule); border-left-width: 4px;
  border-radius: var(--r-ctl); padding: 12px 16px; font-size: 13px; color: var(--warn);
}

.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.timeline li {
  display: grid; grid-template-columns: 76px 1fr; gap: 4px 16px;
  padding: 16px 0; border-bottom: 1px solid var(--rule-soft);
}
.tl-time { font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tl-name { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }
.tl-meta { font-size: 13px; color: var(--muted); margin: 4px 0 0; grid-column: 2; }

.cost { border: 1px solid var(--rule); border-radius: var(--r-card); overflow: hidden; }
.cost-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--rule-soft);
  background: var(--sheet);
}
.cost-row:last-child { border-bottom: 0; }
.cost-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }
.cost-row.total { background: var(--inset); font-weight: 600; }
.cost-row.total span:last-child { font-size: 15px; }
.cost-row.note { font-size: 13px; color: var(--muted); background: var(--sheet); }

#btn-copy { margin-top: 20px; }
.copy-note { font-size: 13px; color: var(--ok); margin: 8px 0 0; }

/* ---------- method ---------- */
.method { margin: 0 auto 32px; max-width: 1080px; padding: 0 20px; }
.method-list {
  display: grid; grid-template-columns: 140px 1fr; gap: 0;
  border-top: 1px solid var(--rule); margin: 16px 0 0;
}
.method-list dt {
  font-size: 13px; font-weight: 600; color: var(--ink); padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.method-list dd {
  font-size: 13px; margin: 0; padding: 12px 0; color: var(--body);
  border-bottom: 1px solid var(--rule-soft);
}
.method-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

/* ---------- credits ---------- */
.credits { margin: 0 auto 40px; max-width: 1080px; padding: 0 20px; }
.credits-lede { font-size: 13px; color: var(--body); margin: 8px 0 16px; }
.credits-lede em { font-style: normal; font-weight: 600; color: var(--ink); }
.credit-list {
  list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule);
  font-size: 13px; columns: 2; column-gap: 32px;
}
.credit-list li { padding: 8px 0; border-bottom: 1px solid var(--rule-soft); break-inside: avoid; max-width: none; }
.credit-list b { color: var(--ink); font-weight: 600; }
.credit-list span { color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 24px 0 40px; background: var(--paper); }
.site-footer p { margin: 0; font-size: 13px; color: var(--body); }
.footer-meta { color: var(--muted); margin-top: 4px !important; }

/* ---------- mobile plan bar ---------- */
.planbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--rule);
}
.planbar-btn {
  font: inherit; width: 100%; min-height: 48px; padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: var(--r-ctl);
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.planbar-count { flex: none; }
.planbar-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.planbar-cue { flex: none; font-weight: 500; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .h2 { font-size: 20px; }
  .lede { font-size: 15px; }
  .hero { padding: 28px 16px 24px; }
  .wrap { padding-inline: 16px; }
  .notice { margin: 0 16px 24px; padding: 16px; }
  .panel { padding: 20px 16px; border-radius: 0; border-left: 0; border-right: 0; max-width: none; }
  .catalog { grid-template-columns: 1fr; gap: 16px; }
  .method { padding: 0 16px; }
  .credits { padding: 0 16px; }
  .method-list { grid-template-columns: 1fr; }
  .method-list dt { padding-bottom: 0; border-bottom: 0; }
  .method-list dd { padding-top: 4px; }
  .credit-list { columns: 1; }
  .timeline li { grid-template-columns: 64px 1fr; }
  .filter-row .filter-label { min-width: 100%; }
  body.has-plan { padding-bottom: 76px; }
}

@media (min-width: 641px) {
  .planbar { display: none; }
}

@media (min-width: 900px) {
  .hero { padding: 56px 20px 40px; }
  h1 { font-size: 40px; }
  .panel { padding: 28px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
