/* Layout refinements for Pow Forecast Beta. */

/* ---------- top bar with search ---------- */
.pf-topbar {
  position: sticky; top: 0; z-index: 1100;
  background: rgba(248, 250, 252, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid #E2E8F0;
}
.pf-topbar-inner {
  max-width: 1120px; margin: 0 auto; height: 64px;
  padding: env(safe-area-inset-top) calc(24px + env(safe-area-inset-right)) 0 calc(24px + env(safe-area-inset-left));
  display: flex; align-items: center; gap: 20px;
}
.pf-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-width: 0; }
.pf-brand-logo { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; border: 1px solid rgba(44, 94, 189, 0.2); flex-shrink: 0; }
.pf-brand-name { font: 700 20px/28px Inter, sans-serif; color: #0A1931; white-space: nowrap; }
.pf-brand-tag {
  font: 500 10px/1 'JetBrains Mono', monospace; text-transform: uppercase; color: #2C5EBD; white-space: nowrap;
  border: 1px solid rgba(44, 94, 189, 0.4); border-radius: 4px; padding: 4px 6px;
}

.pf-gsearch { position: relative; flex: 1; min-width: 0; max-width: 440px; margin-left: auto; }
.pf-gsearch-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 20px !important; color: #737784; pointer-events: none; }
.pf-gsearch:focus-within .pf-gsearch-icon { color: #2C5EBD; }
.pf-gsearch input {
  width: 100%; height: 40px; padding: 0 36px 0 40px; border-radius: 9999px;
  border: 1px solid #E2E8F0; background: #FFFFFF; color: #1E293B; font: 400 14px Inter, sans-serif;
  transition: border-color .15s, box-shadow .15s;
}
.pf-gsearch input::placeholder { color: #737784; }
.pf-gsearch input:focus { outline: none; border-color: #2C5EBD; box-shadow: 0 0 0 3px rgba(44, 94, 189, 0.14); }
.pf-gsearch input::-webkit-search-cancel-button { display: none; }
.pf-gsearch-kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 500 11px 'JetBrains Mono', monospace; color: #737784; border: 1px solid #E2E8F0; border-radius: 4px; padding: 0 5px;
}
.pf-gsearch:focus-within .pf-gsearch-kbd { display: none; }
.pf-gsearch-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1200;
  background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 10px; padding: 4px;
  box-shadow: 0 16px 40px -12px rgba(10, 25, 49, 0.25); max-height: min(70vh, 460px); overflow-y: auto;
}
.pf-gsearch-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.pf-gsearch-row[aria-selected="true"], .pf-gsearch-row:hover { background: #F1F5F9; }
.pf-gsearch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-gsearch-name { font: 600 14px/1.3 Inter, sans-serif; color: #0A1931; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-gsearch-sub { font: 400 12px/1.3 Inter, sans-serif; color: #515F7A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-gsearch-snow { font: 700 15px/1 Inter, sans-serif; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 3px; }
.pf-gsearch-snow small { font: 500 9px 'JetBrains Mono', monospace; color: #737784; text-transform: uppercase; }
.pf-gsearch-all { border-top: 1px solid #EEF1F6; margin-top: 2px; border-radius: 0 0 6px 6px; }
.pf-gsearch-all .material-symbols-outlined { font-size: 20px; color: #2C5EBD; }
.pf-gsearch-all .pf-gsearch-name { color: #2C5EBD; font-weight: 600; }
.pf-gsearch-empty { padding: 14px; text-align: center; font: 500 12px 'JetBrains Mono', monospace; color: #737784; }

.pf-navlinks { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.pf-navlinks a { font: 400 15px/24px Inter, sans-serif; color: #515F7A; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; transition: color .15s; }
.pf-navlinks a:hover { color: #0045A3; }
.pf-navlinks a[aria-current="page"] { color: #2C5EBD; font-weight: 600; }
.pf-navlinks a .material-symbols-outlined { font-size: 20px; }
.pf-navlinks-text { display: none; }

@media (max-width: 1023px) {
  .pf-topbar-inner {
    height: auto; flex-wrap: wrap; gap: 0 12px;
    padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  }
  .pf-gsearch { max-width: none; }
  .pf-gsearch-kbd { display: none; }
  .pf-navlinks {
    order: 3; flex-basis: 100%; gap: 20px; height: 42px; margin-top: 8px; border-top: 1px solid #E2E8F0;
    overflow-x: auto; scrollbar-width: none;
  }
  .pf-navlinks::-webkit-scrollbar { display: none; }
  .pf-navlinks a { font-size: 13.5px; }
  .pf-navlinks-text { display: inline; }
  .pf-navlinks a .material-symbols-outlined { display: none; }
}
@media (max-width: 640px) {
  .pf-brand-tag { display: none; }
  .pf-gsearch input { font-size: 16px; }
}
@media (max-width: 420px) {
  .pf-brand-name { display: none; }
}

/* ---------- browse hero (search moved to the top bar) ---------- */
.pf-browse-hero { padding: 32px 0 24px; display: flex; flex-direction: column; gap: 6px; }
.pf-browse-hero h1 { letter-spacing: -0.02em; }
.pf-link-btn { font: 500 11px 'JetBrains Mono', monospace; color: #2C5EBD; text-transform: uppercase; letter-spacing: .04em; background: none; border: 0; padding: 0; cursor: pointer; }
.pf-link-btn:hover { text-decoration: underline; }

/* ---------- resort page sections ---------- */
.pf-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-section-head p { margin-top: 2px; letter-spacing: .04em; }
@media (max-width: 640px) {
  #period-grid, #hourly-grid { margin-left: -12px; margin-right: -12px; width: auto; }
}
.pf-seg { display: inline-flex; border: 1px solid #E2E8F0; border-radius: 6px; overflow: hidden; background: #FFFFFF; }
.pf-seg button {
  height: 30px; padding: 0 12px; border: 0; border-left: 1px solid #E2E8F0; background: none; cursor: pointer;
  font: 500 11px 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .04em; color: #515F7A; white-space: nowrap;
}
.pf-seg button:first-child { border-left: 0; }
.pf-seg button:hover { color: #2C5EBD; }
.pf-seg button[aria-pressed="true"] { background: #2C5EBD; color: #FFFFFF; }

/* Cards: a touch more depth on hover, consistent with the softer radii. */
a.bg-surface.border.border-gray.rounded-lg { transition: box-shadow .18s, border-color .18s, transform .18s; }
a.bg-surface.border.border-gray.rounded-lg:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { a.bg-surface.border.border-gray.rounded-lg:hover { transform: none; } }

/* ---------- dark appearance ---------- */
html.dark .pf-topbar { background: rgba(15, 23, 42, 0.9); border-color: #334155; }
html[data-theme="black"] .pf-topbar { background: rgba(0, 0, 0, 0.88); }
html.dark .pf-brand-name, html.dark .pf-gsearch-name { color: #F8FAFC; }
html.dark .pf-brand-tag { color: #93C5FD; border-color: rgba(147, 197, 253, 0.45); }
html.dark .pf-gsearch input { background: #111827; border-color: #334155; color: #E2E8F0; }
html.dark .pf-gsearch-kbd { border-color: #334155; color: #94A3B8; }
html.dark .pf-gsearch-results { background: #111827; border-color: #334155; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7); }
html.dark .pf-gsearch-row[aria-selected="true"], html.dark .pf-gsearch-row:hover { background: #1E293B; }
html.dark .pf-gsearch-sub { color: #94A3B8; }
html.dark .pf-gsearch-all { border-color: #1E293B; }
html.dark .pf-gsearch-all .pf-gsearch-name, html.dark .pf-gsearch-all .material-symbols-outlined, html.dark .pf-link-btn { color: #93C5FD; }
html.dark .pf-navlinks { border-color: #334155; }
html.dark .pf-navlinks a { color: #94A3B8; }
html.dark .pf-navlinks a[aria-current="page"] { color: #93C5FD; }
html.dark .pf-seg { background: #111827; border-color: #334155; }
html.dark .pf-seg button { color: #94A3B8; border-color: #334155; }
html.dark .pf-seg button[aria-pressed="true"] { background: #3B6FD1; color: #FFFFFF; }
html.dark .wxg-host {
  --wxg-text: #CBD5E1; --wxg-strong: #F8FAFC; --wxg-muted: #94A3B8; --wxg-border: #1E293B; --wxg-border-strong: #334155;
  --wxg-head: #0F172A; --wxg-night: rgba(0, 0, 0, 0.25); --wxg-accent: #93C5FD; --wxg-line: #94A3B8; --wxg-surface: #111827;
}
html[data-theme="black"] .wxg-host { --wxg-surface: #000000; --wxg-head: #0A0A0A; }

@media print {
  .pf-topbar { display: none !important; }
}

/* Top Forecast cards: a translated name stops at three lines. The full name is on the title. */
.pf-card-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* Inch totals above the browse-card snow bars. The resort timeline stays at its own size. */
.pf-viz-amt { font-size: 11.2px; line-height: 1.15; }

/* A single painted surface avoids Safari's inset native-select shading. */
html .pf-browse-period {
  background: var(--pf-input-bg);
  border-color: var(--pf-border-strong);
  border-radius: 8px;
}
html[data-theme] .pf-browse-period select {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--pf-text-strong);
  border-radius: 0;
  min-height: 32px;
  line-height: 1.4;
}
.pf-browse-period::after {
  content: '';
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--pf-text-muted);
  border-bottom: 1.5px solid var(--pf-text-muted);
  transform: rotate(45deg);
  margin: -3px 5px 0 -18px;
  pointer-events: none;
}
.pf-elev-short { display: none; }
#weather-model-info summary > span:first-child { flex-wrap: wrap; }
#model-count { font-size: 10px; font-weight: 400; }
.pf-timeline-amount { white-space: nowrap; }

@media (max-width: 640px) {
  /* Keep the wordmark in the same row until the hero search leaves view. */
  .pf-topbar-inner { position: relative; }
  .pf-topbar:not(.pf-search-shown) .pf-brand-name { display: inline; font-size: 20px; }
  .pf-topbar.pf-search-shown .pf-brand-name { display: none; }
  .pf-topbar:not(.pf-search-shown) .pf-gsearch { flex: 1; width: 0; }
  #app { padding-left: 16px; padding-right: 16px; }

  /* Compact cards retain all daily values, with the headline beside the name. */
  #browse-cards { gap: 12px; }
  #app .pf-resort-card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px; row-gap: 10px; padding: 14px;
  }
  #app .pf-card-total {
    grid-column: 2; grid-row: 1; margin: 0; text-align: right;
    flex-direction: row-reverse; align-items: center; gap: 6px;
  }
  #app .pf-card-total > div > div:first-child { font-size: 8px; letter-spacing: .02em; margin-bottom: 5px; }
  #app .pf-card-total [data-card-5d] { font-size: 28px; line-height: 1; margin-left: auto; }
  #app .pf-card-identity { grid-column: 1; grid-row: 1; margin: 0; align-self: center; }
  #app .pf-card-name { font-size: 18px; line-height: 1.2; -webkit-line-clamp: 2; }
  #app .pf-card-identity p { font-size: 11px; line-height: 1.4; margin-top: 3px; }
  #app .pf-card-chart { grid-column: 1 / -1; padding-top: 8px; min-width: 0; }
  #app .pf-card-chart > div:first-child { font-size: 8px; margin-bottom: 6px; }
  #app .pf-card-chart .pf-timeline, #app .pf-card-chart .skeleton.h-24 { height: 72px; }
  #app .pf-card-chart .pf-viz-amt { font-size: 10px; }

  #resort-hero { padding: 12px; margin-bottom: 8px; }
  header .pf-resort-hero-layout { grid-template-columns: minmax(0, 1fr) 72px; align-items: center; gap: 8px 10px; }
  #resort-hero .pf-resort-hero-heading { gap: 4px; }
  #resort-title { font-size: 24px; line-height: 1.08; letter-spacing: -.025em; }
  #resort-region { flex-basis: 100%; font-size: 12px; line-height: 1.35; }
  .pf-resort-hero-layout > .pf-resort-snow-ring {
    width: 72px; height: auto; align-self: center;
    border: 1px solid var(--pf-border); border-radius: 10px;
    background: var(--pf-surface-muted); padding: 6px 4px;
  }
  .pf-resort-snow-ring svg { display: none; }
  .pf-resort-snow-ring > div { position: static; gap: 2px; }
  .pf-resort-snow-ring #snow-ring-value { font-size: 24px; }
  .pf-resort-snow-ring #snow-ring-sub { font-size: 8px; margin-top: 0; text-align: center; }
  #elev-switcher {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
    padding: 3px; border: 1px solid var(--pf-border); border-radius: 12px;
    background: var(--pf-surface-muted);
  }
  #elev-switcher .elev-btn {
    min-height: 40px; padding: 6px 2px; justify-content: center; border: 0;
    border-radius: 8px; font: 600 12px/1.3 Inter, sans-serif;
    color: var(--pf-text-muted); background: transparent;
  }
  #elev-switcher .elev-btn[aria-pressed="true"] {
    background: #2C5EBD; color: #fff; box-shadow: 0 2px 5px #0002;
  }
  #elev-switcher .pf-elev-icon, #elev-switcher .pf-elev-label { display: none; }
  #elev-switcher .pf-elev-short { display: inline; }
  #resort-forecast { padding: 12px; gap: 16px; }
  #resort-meta { gap: 3px 8px; font: 400 11px/1.4 Inter, sans-serif; }
  #resort-meta > .text-border-gray { display: none; }
  #resort-meta > span:first-child { flex-basis: 100%; }
  #resort-forecast .pf-snow-forecast-heading { gap: 6px; margin-bottom: 8px; }
  #resort-forecast .pf-snow-outlook-controls { display: none; }
  #resort-forecast .pf-snow-outlook-chart { padding: 10px; }
  #totals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  #totals-grid .pf-snow-total {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 8px 7px; border-radius: 10px;
  }
  #totals-grid .pf-snow-total > span:first-child { font: 600 9px/1 Inter, sans-serif; white-space: nowrap; }
  #totals-grid .pf-snow-total > span:last-child { font-size: 25px; }
  [data-export-action="print"] { display: none; }
  #outlook-viz { overflow-x: auto; padding-top: 8px; }
  #outlook-viz .pf-timeline { min-width: 280px; height: 128px; }
  #outlook-viz .pf-timeline-amount { font-size: 10px; }
  #outlook-viz > .viz-animate { animation: none; }
  #outlook-viz .pf-timeline > .w-px { margin-left: 5px; margin-right: 5px; }
  #outlook-viz .pf-timeline > div > span:last-child { margin-top: 3px; }
  #weather-model-info summary { padding: 14px; gap: 8px; }
  #weather-model-info summary > span:first-child { font: 600 13px/1.4 Inter, sans-serif; }
  #model-count { flex-basis: 100%; padding-left: 26px; line-height: 1.5; }
  #model-list > div { flex-wrap: wrap; gap: 6px; }
}
