:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --card-soft: #faf8f3;
  --text: #1c2622;
  --muted: #64706b;
  --line: #e6e1d6;
  --accent: #2f6f5e;
  --accent-strong: #245848;
  --accent-soft: #e3efe9;
  --accent-ink: #ffffff;
  --hero-bg: #2f6f5e;
  --rain: #3b78b5;
  --sun: #e08a1e;
  --error: #b3261e;
  --shadow: 0 1px 2px rgb(28 38 34 / 0.05), 0 8px 28px rgb(28 38 34 / 0.07);
  --hot: #f4a259;
  --warm: #f2cc4f;
  --mild: #8fca84;
  --cool: #74b0d6;
  --cold: #8a96e6;
  --radius: 18px;
  --display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --card: #1b2320;
    --card-soft: #222c28;
    --text: #e8eeeb;
    --muted: #9aa8a2;
    --line: #2d3833;
    --accent: #5fb39a;
    --accent-strong: #79c7af;
    --accent-soft: #233a33;
    --accent-ink: #0e1a16;
    --hero-bg: #1d4a3e;
    --rain: #7fb2e5;
    --sun: #f2b25c;
    --error: #ff8a80;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

main, footer {
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

h1, h2, h3 { font-family: var(--display); }

h2 {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Hero */

.hero {
  --hero-bg: #2f6f5e;
  position: relative;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgb(255 255 255 / 0.14), transparent 40%),
    radial-gradient(circle at 10% 90%, rgb(242 204 79 / 0.18), transparent 45%),
    linear-gradient(160deg, #3a8571 0%, #2f6f5e 45%, #22564a 100%);
  padding: calc(env(safe-area-inset-top) + 2.25rem) max(1.25rem, env(safe-area-inset-right)) 5.5rem max(1.25rem, env(safe-area-inset-left));
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .hero {
    --hero-bg: #1d4a3e;
    background:
      radial-gradient(circle at 85% 10%, rgb(255 255 255 / 0.08), transparent 40%),
      radial-gradient(circle at 10% 90%, rgb(242 204 79 / 0.1), transparent 45%),
      linear-gradient(160deg, #24594b 0%, #1d4a3e 50%, #153a30 100%);
  }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 728px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
}

.logo {
  width: 1.9rem;
  height: 1.9rem;
  color: #fff;
}

.logo .strap { fill: var(--hero-bg); }

.tagline {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  max-width: 16em;
}

.subtitle {
  margin: 0;
  max-width: 36em;
  color: rgb(255 255 255 / 0.82);
}

/* Cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}

.form-card {
  position: relative;
  z-index: 2;
  margin-top: -4rem;
}

#results:not([hidden]) .card {
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

#results .card + .card { animation-delay: 0.08s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Form */

.field { margin-bottom: 1rem; }

.field > label, legend {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="text"], input[type="date"], input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card-soft);
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input[type="text"]:focus, input[type="date"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* iOS Safari otherwise centers the date and sizes the input to its content. */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-height: 3rem;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

button:focus-visible, .chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}

.combo { position: relative; }

.combo input { padding-left: 2.5rem; }

.field-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 1.2rem;
  height: 1.2rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  pointer-events: none;
}

#suggestions {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.14);
}

#suggestions li {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
}

#suggestions li:hover, #suggestions li[aria-selected="true"] {
  background: var(--accent-soft);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0.25rem 0 1.25rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  position: relative;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
}

.chip span::before {
  content: "+";
  font-weight: 700;
  color: var(--muted);
}

.chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chip input:checked + span::before {
  content: "✓";
  color: inherit;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.inline input {
  width: 4.25rem;
  padding: 0.35rem 0.5rem;
  text-align: center;
}

.inline[hidden] { display: none; }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

button {
  font: inherit;
  cursor: pointer;
}

.primary {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #3a8571, #2f6f5e);
  border: 0;
  border-radius: 14px;
  padding: 0.85rem 1.6rem;
  box-shadow: 0 6px 16px rgb(47 111 94 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.15);
  transition: transform 0.12s, box-shadow 0.12s;
}

.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgb(47 111 94 / 0.4); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.65; cursor: progress; transform: none; }

.ghost {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.units {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--card-soft);
  border: 1px solid var(--line);
}

.units button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0.4rem 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.units button[aria-pressed="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

#status { margin: 0.75rem 0 0; min-height: 1.5em; color: var(--muted); }
#status:empty { margin: 0; min-height: 0; }
#status.error { color: var(--error); }

/* Weather */

#weather-summary { margin: 0; }

#day-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  list-style: none;
  padding: 0.25rem 0.1rem 0.75rem;
  margin: 1rem -0.1rem 0.5rem;
  scrollbar-width: thin;
}

.day {
  flex: 0 0 5.25rem;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.7rem 0.3rem 0.6rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--band) 38%, transparent), transparent 75%),
    var(--card-soft);
  font-size: 0.85rem;
  text-align: center;
}

.day.historical {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--band) 70%, var(--line));
}

.band-hot { --band: var(--hot); }
.band-warm { --band: var(--warm); }
.band-mild { --band: var(--mild); }
.band-cool { --band: var(--cool); }
.band-cold { --band: var(--cold); }

.day .dow { font-weight: 700; font-family: var(--display); }
.day .dom { color: var(--muted); font-size: 0.75rem; }

.wx-icon svg {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
  margin: 0.3rem auto 0.15rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wx-sun svg { stroke: var(--sun); }
.wx-partly svg { stroke: var(--muted); }
.wx-partly svg path:nth-child(-n+2) { stroke: var(--sun); }
.wx-rain svg, .wx-snow svg { stroke: var(--rain); }
.wx-snow svg path:last-child { stroke-width: 2.6; }

.day .temps strong { font-size: 1.05rem; }
.day .temps { color: var(--muted); }
.day .temps strong { color: var(--text); }
.day .wx { color: var(--rain); font-size: 0.72rem; font-weight: 600; min-height: 1.2em; }

/* Packing list */

.list-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.list-head h2 { margin: 0; }
.list-head .ghost { margin-left: auto; }

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.85rem 0 0.25rem;
}

.progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

#progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8fca84);
  transition: width 0.3s ease;
}

#item-total { white-space: nowrap; font-weight: 600; }

#plan-note { margin: 0.25rem 0 1.25rem; }

#packing-list {
  columns: 2 280px;
  column-gap: 1.75rem;
}

.pack-section {
  break-inside: avoid;
  margin-bottom: 1.4rem;
}

.pack-section h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.pack-section h3::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.pack-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pack-section li label {
  display: grid;
  grid-template-columns: auto 2.1rem 1fr;
  align-items: center;
  column-gap: 0.55rem;
  padding: 0.5rem 0.4rem;
  margin: 0 -0.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.pack-section li label:hover { background: var(--card-soft); }

.pack-section li + li label { border-top: 1px solid var(--line); border-radius: 0; }
.pack-section li + li label:hover { border-radius: 10px; }

.pack-section li input {
  appearance: none;
  -webkit-appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  display: grid;
  place-content: center;
  transition: all 0.15s;
}

.pack-section li input::after {
  content: "";
  width: 0.4rem;
  height: 0.7rem;
  border: solid var(--accent-ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px) scale(0);
  transition: transform 0.15s;
}

.pack-section li input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.pack-section li input:checked::after { transform: rotate(45deg) translate(-1px, -1px) scale(1); }

.qty {
  justify-self: center;
  min-width: 1.9rem;
  padding: 0.05rem 0.4rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.name { font-weight: 500; }

.note {
  grid-column: 3;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -0.15rem;
}

.pack-section li:has(input:checked) .name {
  text-decoration: line-through;
  color: var(--muted);
}

.pack-section li:has(input:checked) .qty { opacity: 0.5; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 0.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

footer a { color: inherit; }

@media (max-width: 520px) {
  .hero { padding-top: calc(env(safe-area-inset-top) + 1.5rem); padding-bottom: 5rem; }
  .card { padding: 1.15rem; border-radius: 16px; }
  .row { gap: 0.75rem; grid-template-columns: 1.4fr 1fr; }
  .actions .primary { flex: 1; }
}

@media print {
  :root { --bg: #fff; }
  .hero, #trip-form, footer, #print, .progress-row { display: none; }
  .card { border: 0; padding: 0; box-shadow: none; }
}
