/* Your Plan page only */

/* ---------- Layout ----------
   Phones: intro, form, result in one column.
   Desktop: the form on the left, the intro (before a plan) or the result (after) fills the right side. */
.plan-grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
  grid-template-areas: "intro" "form" "result";
}
.plan-intro { grid-area: intro; display: grid; gap: .75rem; }
.plan-intro h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.plan-intro p { margin: 0; max-width: 62rem; }
.plan-intro[hidden] { display: none; }
#plan-form { grid-area: form; }
#plan-result { grid-area: result; }

#plan-form .group { margin: 0 0 1.5rem; }
#plan-form .btn { width: 100%; }
#plan-form .form-actions { display: flex; gap: .6rem; }
#plan-form .form-actions .btn { flex: 1 1 0; width: auto; }
#get-weather { margin: 0 0 .5rem; }
.weather-note, #weather-status { margin: 0 0 .5rem; font-size: .9rem; }
#weather-status { min-height: 1.3em; }
#get-weather:disabled { cursor: wait; opacity: .7; }

.text-input {
  display: block;
  width: 100%;
  max-width: 24rem;
  min-height: 3rem;
  padding: .6rem 1rem;
  background: var(--field);
  color: inherit;
  border: 2px solid transparent;
  border-radius: 1rem;
  font: inherit;
}
.text-input::placeholder { color: inherit; opacity: .6; }
.text-input:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.text-input[aria-invalid="true"] { border-color: #b3261e; }
.hint { margin: .4rem 0 0; font-size: .9rem; opacity: .85; }
.save-status { margin: .5rem 0 0; font-size: .9rem; }
.save-status a { font-weight: 700; text-underline-offset: 3px; }

.temp-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .35rem; }
.temp-row .field-label { margin: 0; }
.temp-value {
  padding: .2rem .75rem;
  background: var(--field);
  border-radius: 999px;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}
#temp {
  width: 100%;
  margin: .25rem 0;
  accent-color: var(--accent);
  cursor: pointer;
}
#temp:focus-visible { outline: 3px solid currentColor; outline-offset: 5px; }
#temp::-webkit-slider-runnable-track { height: .5rem; background: var(--field); border-radius: 999px; }
#temp::-webkit-slider-thumb {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: -.375rem;
  appearance: none;
  background: var(--accent);
  border: 3px solid var(--panel-line);
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .2);
}
#temp::-moz-range-track { height: .5rem; background: var(--field); border-radius: 999px; }
#temp::-moz-range-thumb {
  width: .9rem;
  height: .9rem;
  background: var(--accent);
  border: 3px solid var(--panel-line);
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .2);
}

#plan-result[hidden], #result-warning[hidden] { display: none; }

/* ---------- Result ---------- */
#plan-result { animation: pop .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

#plan-result h2 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
#plan-result h3 { margin: 0 0 .5rem; font-size: 1.05rem; }

.pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.pill {
  padding: .3rem .8rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 700;
}

.warning {
  margin: 1rem 0 0;
  padding: .75rem 1rem;
  background: #b3261e;
  color: #fff;
  border-radius: .9rem;
  font-weight: 700;
}

.sports-list, .checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }

.sports-list li {
  padding: .8rem 1rem;
  background: var(--field);
  border-radius: 1rem;
}
.sports-list .sport-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.sports-list strong { font-family: var(--display); font-size: 1.15rem; }
.badge {
  padding: .1rem .55rem;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sports-list p { margin: .2rem 0 0; opacity: .9; }

.checklist { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .4rem .8rem; }
.checklist li { display: flex; align-items: center; gap: .55rem; }
.checklist input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--accent); }
.checklist label { cursor: pointer; }
.checklist input:checked + label { text-decoration: line-through; opacity: .6; }

/* ---------- Verdict, best pick, actions ---------- */
.verdict {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  background: var(--field);
  border-left: .45rem solid var(--accent);
  border-radius: 1rem;
}
.verdict[data-level="go"]   { border-left-color: #1e7a3c; }
.verdict[data-level="ok"]   { border-left-color: #b26a00; }
.verdict[data-level="stay"] { border-left-color: #b3261e; }
.verdict-label { margin: 0 0 .3rem; font: 800 clamp(1.25rem, 3vw, 1.6rem)/1.2 var(--display); }
.verdict-text { margin: 0; }

.best-pick { padding: 1rem 1.1rem; background: var(--field); border-radius: 1rem; }
.best-pick .sport-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.best-pick .sport-head strong { font-family: var(--display); font-size: 1.5rem; }
.score { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: .6rem 0; font-weight: 700; }
.meter { flex: 1 1 8rem; max-width: 14rem; height: .6rem; background: var(--panel-line); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s ease; }
.why { margin: 0 0 .6rem; padding-left: 1.2rem; }
.why li { margin-bottom: .2rem; }
.tip { margin: 0; font-style: italic; }

#plan-result > div + div { margin-top: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.actions .btn { width: auto; flex: 1 1 9rem; padding: .75rem 1.2rem; }
.action-status { min-height: 0; margin: .5rem 0 0; font-size: .9rem; }
.action-status:empty, .save-status:empty { display: none; }
.print-only { display: none; }

/* ---------- Printing / Save as PDF: only the report ---------- */
@media print {
  #sky, #site-header, #site-footer, #plan-form, #plan-intro, #missing-dialog, .no-print, .lead, main > h1 { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  main { padding: 0; width: 100%; max-width: none; }
  .plan-grid { display: block; margin: 0; }
  #plan-result { display: block !important; }
  #plan-result > div + div { margin-top: 1rem; }
  #plan-result {
    animation: none; background: #fff !important; border: 1px solid #999; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none; color: #000; padding: 1rem; transform: none;
  }
  .print-only { display: block; }
  .report-head { margin: 0 0 .5rem; font-weight: 700; color: #444; }
  .pill, .badge { background: #eee !important; color: #000 !important; border: 1px solid #888; }
  .verdict, .best-pick, .sports-list li { background: #f4f4f4 !important; break-inside: avoid; }
  .warning { background: #fff !important; color: #000 !important; border: 2px solid #000; }
  .meter { background: #ddd; border: 1px solid #888; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .meter span { background: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .checklist input { appearance: auto; }
  .checklist input:checked + label { text-decoration: none; opacity: 1; }
}

/* ---------- Big city name, missing-fields pop-up ---------- */
.weather-city {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .1rem 0 .15rem;
  font: 800 clamp(1.7rem, 3.4vw, 2.3rem)/1.1 var(--display);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.weather-city::before {
  content: "";
  flex: none;
  width: .8em;
  height: .8em;
  background: var(--accent);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: inset 0 0 0 .2em var(--panel-line);
}
.weather-city[hidden] { display: none; }

/* missing field: a soft glass highlight with a red ring and a small "Required" note (no layout shift) */
#plan-form .group.missing:not(fieldset),
#plan-form fieldset.missing .choices { position: relative; }
#plan-form .group.missing:not(fieldset)::before,
#plan-form fieldset.missing .choices::before {
  content: "";
  position: absolute;
  inset: -.45rem -.6rem;
  z-index: -1;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, .4);
  box-shadow: inset 0 0 0 1.5px rgba(217, 48, 37, .75), 0 0 0 4px rgba(217, 48, 37, .13), 0 10px 26px rgba(217, 48, 37, .15);
  pointer-events: none;
  animation: missing-in .45s cubic-bezier(.2, .9, .3, 1.2);
}
#plan-form .group.missing > legend::after,
#plan-form .group.missing label.field-label::after {
  content: "· Required";
  margin-left: .5rem;
  color: #d93025;
  font-size: .8em;
  font-weight: 800;
  letter-spacing: .04em;
}
html[data-weather="rainy"] #plan-form .group.missing > legend::after,
html[data-weather="rainy"] #plan-form .group.missing label.field-label::after { color: #ffb4ab; }
@keyframes missing-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
#plan-form .text-input[aria-invalid="true"] { border-color: rgba(217, 48, 37, .65); }
#plan-form .error:empty { display: none; }

.missing-dialog {
  width: min(92vw, 26rem);
  padding: 0;
  background: #fff;
  color: #14212d;
  border: 0;
  border-top: .5rem solid #d93025;
  border-radius: 1.25rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
html[data-weather="rainy"] .missing-dialog { background: #14263b; color: #eef5fc; }
.missing-dialog::backdrop { background: rgba(8, 16, 28, .6); backdrop-filter: blur(3px); }
.missing-dialog[open] { animation: pop .3s cubic-bezier(.2, .9, .3, 1.2); }
.missing-dialog > * { margin-inline: 1.5rem; }
.missing-head { display: flex; align-items: center; gap: .8rem; margin-top: 1.4rem; margin-bottom: .6rem; }
.missing-head h2 { font-size: 1.5rem; }
.missing-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  background: #d93025;
  color: #fff;
  border-radius: 50%;
  font: 800 1.6rem/1 var(--display);
}
.missing-lead { margin-bottom: .6rem; }
.missing-list { margin: 0 1.5rem 1.4rem; padding: 0; list-style: none; display: grid; gap: .4rem; }
.missing-list li {
  padding: .6rem .9rem;
  background: rgba(217, 48, 37, .12);
  border-left: .35rem solid #d93025;
  border-radius: .6rem;
  font-weight: 700;
}
.missing-dialog .btn { display: block; width: calc(100% - 3rem); margin-bottom: 1.5rem; }

/* ---------- Tablet and up: form is two columns ---------- */
@media (min-width: 48rem) and (max-width: 59.99rem) {
  #plan-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
  }
  #plan-form .group { margin-bottom: 1rem; }
  #place-group .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #weather-group { grid-column: 1 / -1; }
  #weather-group .choices { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #plan-form > .form-actions, #plan-form > #draft-status { grid-column: 1 / -1; }
}

/* ---------- Desktop: everything on one screen, the result uses the right side ---------- */
@media (min-width: 60rem) {
  body.plan-page {
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  .plan-page main {
    flex: 1;
    width: 100%;
    max-width: 96rem;
    padding-block: .75rem 0;
  }
  .plan-page #site-footer { padding-block: .4rem .6rem; }
  .plan-page #site-footer p { padding-top: .5rem; font-size: .82rem; }

  .plan-grid {
    grid-template-columns: minmax(23rem, 28rem) minmax(0, 1fr);
    grid-template-areas: "form side";
    gap: 1.25rem;
    align-items: stretch;
  }
  .plan-intro, #plan-result { grid-area: side; }

  /* before a plan: a friendly empty state that fills the right side */
  .plan-intro {
    align-content: center;
    justify-items: start;
    padding: 2rem 2.5rem;
  }
  .plan-intro h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); }
  .plan-intro p { font-size: 1.15rem; max-width: 34rem; }

  /* the form, made compact */
  #plan-form { padding: 1rem 1.25rem; align-self: start; }
  #plan-form .group { margin: 0 0 .75rem; }
  #plan-form legend, #plan-form label.field-label { margin-bottom: .35rem; }
  #plan-form .text-input { min-height: 2.5rem; padding: .35rem .9rem; max-width: none; }
  #plan-form .hint { margin-top: .25rem; font-size: .8rem; }
  /* on desktop the highlight and the pop-up show what is missing, so the form never grows */
  #plan-form .error {
    position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  #place-group .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  #weather-group .choices { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .35rem; }
  #plan-form .choice span { min-height: 2.5rem; padding: .3rem .4rem; font-size: .92rem; line-height: 1.15; }
  #weather-group .choice span { flex-direction: column; gap: .1rem; min-height: 3.6rem; font-size: .8rem; }
  #get-weather { padding: .65rem 1.2rem; margin-bottom: .35rem; }
  .weather-note { margin-bottom: .35rem; font-size: .72rem; line-height: 1.35; opacity: .85; }
  #weather-status { min-height: 0; margin-bottom: .45rem; font-size: .85rem; }
  #weather-status:empty { display: none; }
  #plan-form > .btn { padding: .8rem 1.4rem; }

  /* the result: a compact dashboard so nothing needs scrolling */
  #plan-result {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    grid-template-areas:
      "head    head"
      "verdict verdict"
      "best    other"
      "gear    gear"
      "actions actions";
    gap: .8rem 1.25rem;
    align-content: start;
    padding: 1rem 1.25rem;
    font-size: .95rem;
    line-height: 1.4;
  }
  .res-head { grid-area: head; }
  .res-verdict { grid-area: verdict; }
  .res-best { grid-area: best; }
  .res-other { grid-area: other; }
  .res-gear { grid-area: gear; }
  .res-actions { grid-area: actions; }
  #plan-result > div + div { margin-top: 0; }
  .print-only { grid-column: 1 / -1; }
}

@media (min-width: 60rem) {
  .res-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
}

/* ---------- Shorter laptop screens: tighten a little more so there is still no scrolling ---------- */
@media (min-width: 60rem) and (max-height: 56rem) {
    .plan-page #site-header { top: .3rem; padding-top: .3rem; }
  .plan-page .site-nav { padding-block: .3rem; }
  .plan-page main { padding-top: .5rem; }
  #plan-form { padding: .7rem 1.1rem; }
  #plan-form .group { margin-bottom: .5rem; }
  #plan-form .hint { display: none; }
  #plan-form .text-input { min-height: 2.2rem; padding-block: .2rem; }
  #plan-form .choice span { min-height: 2.1rem; }
  #weather-group .choice span { min-height: 2.9rem; }
  #get-weather { padding: .5rem 1rem; }
  .weather-note { font-size: .68rem; line-height: 1.3; margin-bottom: .2rem; }
  .weather-city { font-size: 1.6rem; margin: 0; }
  #weather-status { margin-bottom: .3rem; font-size: .8rem; }
  #plan-form > .btn { padding: .65rem 1.2rem; }
  #plan-result { gap: .55rem 1.1rem; padding: .7rem 1.1rem; font-size: .9rem; line-height: 1.3; }
  .best-pick, .verdict { padding: .6rem .9rem; }
  .sports-list { gap: .4rem; }
  .sports-list li { padding: .5rem .8rem; }
  .why { margin-bottom: .3rem; }
  .actions .btn { padding: .55rem 1rem; }
  .plan-page #site-footer { padding-block: .2rem .3rem; }
  .plan-page #site-footer p { padding-top: .3rem; font-size: .75rem; }
}

/* ---------- Fill the whole screen height so there is no empty space below ---------- */
@media (min-width: 60rem) {
  .plan-page main { display: flex; flex-direction: column; padding-bottom: .5rem; }
  .plan-grid { flex: 1; min-height: 0; }

  /* form: stretch to the bottom and spread the groups out evenly */
  #plan-form {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  #plan-form .group { margin-bottom: 0; }

  /* result: stretch to the bottom and spread the blocks out evenly */
  #plan-result { align-content: space-between; }
  .res-actions { align-self: end; }
}

/* ---------- Tall screens: make everything bigger instead of leaving gaps ---------- */
@media (min-width: 60rem) and (min-height: 62rem) {
  .plan-page main { padding-top: 1.25rem; padding-bottom: 1rem; }

  #plan-form { padding: 1.75rem 1.75rem 1.5rem; }
  #plan-form legend, #plan-form label.field-label { font-size: 1.15rem; margin-bottom: .55rem; }
  #plan-form .text-input { min-height: 3.1rem; font-size: 1.05rem; }
  #plan-form .hint { font-size: .92rem; }
  #plan-form .choice span { min-height: 3.1rem; font-size: 1.02rem; }
  #weather-group .choice span { min-height: 4.6rem; font-size: .92rem; }
  #weather-group .wx-icon { width: 1.7em; height: 1.7em; }
  #get-weather { padding: .85rem 1.2rem; font-size: 1.05rem; }
  .weather-note { font-size: .8rem; }
  .weather-city { font-size: 2.6rem; }
  #weather-status { font-size: 1rem; }
  .temp-value { font-size: 1.5rem; }
  #plan-form > .form-actions .btn { padding: 1.05rem 1.4rem; font-size: 1.1rem; }

  .plan-intro h1 { font-size: clamp(2.6rem, 4.5vw, 4.2rem); }
  .plan-intro p { font-size: 1.3rem; }

  #plan-result { padding: 1.75rem 2rem; font-size: 1.1rem; line-height: 1.5; }
  #plan-result h2 { font-size: 2.4rem; }
  #plan-result h3 { font-size: 1.25rem; margin-bottom: .7rem; }
  .pill { font-size: 1.05rem; padding: .4rem 1rem; }
  .verdict { padding: 1.5rem 1.75rem; }
  .verdict-label { font-size: 2.1rem; }
  .verdict-text { font-size: 1.2rem; }
  .best-pick { padding: 1.5rem 1.75rem; }
  .best-pick .sport-head strong { font-size: 2.1rem; }
  .score { margin: 1rem 0; }
  .why li { margin-bottom: .35rem; }
  .sports-list { gap: .9rem; }
  .sports-list li { padding: 1.1rem 1.4rem; }
  .sports-list strong { font-size: 1.4rem; }
  .checklist { gap: .7rem 1rem; }
  .checklist input { width: 1.4rem; height: 1.4rem; }
  .actions .btn { padding: 1.05rem 1.4rem; font-size: 1.1rem; }
  .save-status, .action-status { font-size: 1rem; }
}