/* ============================================================================
   PALARID HOME — styles for the redesigned homepage
   Loaded last. Everything is namespaced .ph-* so it cannot affect the other
   523 panes. Uses design tokens only — no hard-coded hex in components, so
   light and dark are both complete by construction.
   ============================================================================ */

#ph-root { max-width: 100%; }

/* Type scale: four sizes, two weights, body ≥ 16px. */
.ph-h1        { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.15; font-weight: 700;
                letter-spacing: -0.02em; margin: 0 0 10px;
                /* BUG 15 — solid colour. Gradient headings put pale purple on
                   white and failed AA on the first word. */
                color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
.ph-h1-sm     { font-size: clamp(22px, 3vw, 28px); margin-bottom: 4px; }
.ph-sub       { font-size: 17px; line-height: 1.6; color: var(--text-2); margin: 0 0 22px; max-width: 56ch; }
.ph-date      { font-size: 15px; color: var(--text-2); margin: 0; }
.ph-muted     { color: var(--text-3); font-size: 14px; }
.ph-big       { font-size: 34px; font-weight: 700; margin: 6px 0 0; letter-spacing: -0.02em; }
.ph-big-sm    { font-size: 22px; font-weight: 700; }

/* ------------------------------------------------------------------- HERO */
.ph-hero      { padding: clamp(24px, 6vw, 64px) 0 40px; max-width: 62ch; }
.ph-cta-row   { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.ph-proof     { display: flex; gap: 20px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0;
                color: var(--text-3); font-size: 14px; }
.ph-proof li  { position: relative; padding-left: 16px; }
.ph-proof li::before { content: ""; position: absolute; left: 0; top: 50%; width: 6px; height: 6px;
                margin-top: -3px; border-radius: 50%; background: var(--accent); }

/* ------------------------------------------------------------------ BUTTONS
   One button system. 44px minimum height everywhere (WCAG 2.5.8 + touch). */
.ph-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
          min-height: 44px; padding: 11px 18px; border-radius: 10px; font: inherit;
          font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
          transition: background .16s ease, border-color .16s ease, color .16s ease; }
.ph-btn-primary { background: var(--accent); color: var(--accent-fg); }
.ph-btn-primary:hover { background: var(--accent-hover, var(--accent)); }
.ph-btn-primary[disabled] { opacity: .6; cursor: default; }
.ph-btn-ghost   { background: transparent; color: var(--text); border-color: var(--border-control); }
.ph-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.ph-btn-quiet   { background: transparent; color: var(--text-2); border-color: var(--border);
                  padding: 8px 12px; font-size: 14px; }
.ph-btn-quiet:hover { color: var(--text); border-color: var(--border-control); }

.ph-link { background: none; border: 0; padding: 0; font: inherit; font-size: inherit;
           color: var(--accent); text-decoration: underline; cursor: pointer; }
.ph-link:hover { text-decoration: none; }

/* Focus is visible on everything, always. */
#ph-root :focus-visible,
.ph-undo :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ------------------------------------------------------------------- HUB */
.ph-hub { padding: 8px 0 40px; }
.ph-greet-row { display: flex; justify-content: space-between; align-items: flex-start;
                gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ph-rename { display: flex; gap: 8px; margin-top: 8px; flex: 1 1 100%; }
.ph-rename input { flex: 1; min-height: 44px; padding: 10px 14px; font-size: 16px;
                   border-radius: 10px; border: 1px solid var(--border-control);
                   background: var(--surface-1); color: var(--text); }

/* One command input. */
.ph-command { display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
              background: var(--surface-1); border: 1px solid var(--border-control);
              border-radius: 12px; padding: 6px 6px 6px 14px; }
.ph-command:focus-within { border-color: var(--accent); }
.ph-cmd-icon  { display: flex; color: var(--text-3); }
.ph-cmd-input { flex: 1; border: 0; background: none; color: var(--text);
                font: inherit; font-size: 16px; min-height: 40px; outline: none; }
.ph-cmd-input::placeholder { color: var(--text-3); }
.ph-cmd-go { flex: 0 0 auto; }

/* BUG 13 — the old suggestion dropdown was a dark navy panel with near-black
   text inside a light page. Tokens only, so it is correct in both themes. */
.ph-results { background: var(--surface-1); border: 1px solid var(--border);
              border-radius: 12px; padding: 6px; margin-bottom: 20px;
              box-shadow: var(--e-2); display: flex; flex-direction: column; gap: 2px; }
.ph-result { display: block; width: 100%; text-align: left; background: none; border: 0;
             color: var(--text); font: inherit; font-size: 15px; padding: 11px 12px;
             min-height: 44px; border-radius: 8px; cursor: pointer; }
.ph-result:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ CARDS
   One card style, one radius, one shadow. Maximum three above the fold. */
.ph-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.ph-card  { background: var(--surface-1); border: 1px solid var(--border);
            border-radius: 14px; padding: 18px; box-shadow: var(--e-1); min-width: 0; }
.ph-card-h { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600;
             margin: 0 0 12px; color: var(--text); }
.ph-card-h svg { color: var(--accent); flex: 0 0 auto; }

.ph-add { display: flex; gap: 8px; margin-bottom: 12px; }
.ph-add-input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; font-size: 16px;
                border-radius: 10px; border: 1px solid var(--border-control);
                background: var(--bg); color: var(--text); }
.ph-add-input::placeholder { color: var(--text-3); }

.ph-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ph-row  { display: flex; align-items: center; justify-content: space-between; gap: 10px;
           padding: 8px 0; border-bottom: 1px solid var(--border); }
.ph-row:last-child { border-bottom: 0; }
.ph-row-title { font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.ph-row.is-done .ph-row-title { text-decoration: line-through; color: var(--text-3); }
.ph-done { flex: 0 0 auto; }
.ph-jump-btn { background: none; border: 0; padding: 8px 0; min-height: 44px; font: inherit;
               font-size: 15px; color: var(--accent); text-align: left; cursor: pointer; width: 100%; }
.ph-jump-btn:hover { text-decoration: underline; }

/* Every data-driven component has an empty state. */
.ph-empty { color: var(--text-3); font-size: 14px; line-height: 1.6; padding: 10px 0; margin: 0; }

.ph-weather { margin-top: 10px; font-size: 15px; }
.ph-live { margin-top: 10px; font-size: 13px; color: var(--text-3); min-height: 1em; }

/* ------------------------------------------------------------------ TILES */
.ph-section-h { font-size: 17px; font-weight: 600; margin: 0 0 14px; color: var(--text); }
.ph-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr));
            gap: 12px; }
.ph-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
           min-height: 96px; padding: 16px; border-radius: 14px; cursor: pointer;
           background: var(--surface-1); border: 1px solid var(--border); color: var(--text);
           font: inherit; font-size: 15px; font-weight: 600; text-align: left;
           transition: border-color .16s ease, background .16s ease; }
.ph-tile:hover { border-color: var(--accent); background: var(--surface-2); }
.ph-tile-ic { display: flex; color: var(--accent); }

/* -------------------------------------------------------------------- UNDO
   BUG 18 — the old toast rendered underneath buttons at low contrast. This
   sits above everything, uses tokens, and clears the mobile navigation. */
.ph-undo { position: fixed; left: 50%; transform: translateX(-50%);
           bottom: calc(16px + env(safe-area-inset-bottom, 0px));
           display: flex; align-items: center; gap: 14px;
           background: var(--surface-1); color: var(--text);
           border: 1px solid var(--border-control); border-radius: 12px;
           padding: 12px 16px; box-shadow: var(--e-3);
           z-index: var(--z-toast, 500); font-size: 14px; max-width: calc(100vw - 32px); }
@media (max-width: 860px) {
  .ph-undo { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px;
             transform: none; max-width: none; }
}

/* ------------------------------------------------------------------- A11Y */
.ph-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0;
                      margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
                      border: 0; }

/* ----------------------------------------------------------------- MOBILE
   Verified against 360 / 390 / 430px: single column, no horizontal scroll. */
@media (max-width: 900px) {
  .ph-cards { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .ph-hero { padding-top: 16px; }
  .ph-cta-row .ph-btn { width: 100%; }
  .ph-command { flex-wrap: wrap; }
  .ph-cmd-go { width: 100%; }
  .ph-greet-row { flex-direction: column; align-items: stretch; }
  .ph-proof { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .ph-btn, .ph-tile, .ph-result { transition: none; }
}
