body { font-family: Arial, sans-serif; margin: 0; padding: 0; }

/* Page header: centered title, time pinned to right edge */
.page-header { position: relative; padding: 6px 12px; }
.page-title  { text-align: center; margin: 0; font-size: 1.1em; }
.time-info   {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72em;
  color: #666;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .time-info {
    position: static;
    display: block;
    text-align: right;
    margin-top: 2px;
    transform: none;
  }
}

table { border-collapse: collapse; margin: 4px auto; }
th, td { text-align: center; padding: 3px; vertical-align: top; }

.icon {
  width: 90px;
  height: 90px;
  margin: 0 auto;
  background-image: url('../weather-spritesheet.png');
  background-repeat: no-repeat;
  background-size: 540px 270px;
}

.description {
  font-size: 0.75em;
  color: #555;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.temp-high { font-weight: 700; }
.temp-low  { color: #333; opacity: 0.9; }

/* Existing shading (keep exactly) */
.yesterday { background-color: #f0f0f0; }
.today     { background-color: #fffacd; }

/* Right-side links under table */
.actions {
  text-align: right;
  margin: 6px 12px 10px;
  font-size: 0.9em;
}
.actions a {
  color: #0b70c9;
  text-decoration: none;
  margin-left: 6px;
}
.actions a:hover { text-decoration: underline; }

/* Hover targets */
th.day-hover { cursor: default; }
.icon.icon-hover { cursor: default; }

/* ---------- Hourly Popover ---------- */
#wq-popover {
  position: fixed;
  z-index: 9999;
  display: none;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  padding: 8px 10px;
  max-width: 380px;
  font-size: 12px;
  pointer-events: auto;
}

/* Two-column popover body: Hourly on left, Current on right */
#wq-popover .wq-popbody {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#wq-popover .wq-hourly {
  flex: 0 0 auto;
}

/* Current conditions panel */
#wq-popover .wq-current {
  flex: 0 0 150px;
  border-left: 1px solid rgba(0,0,0,0.15);
  padding-left: 8px;
  padding-right: 6px;
  font-size: 12px;
  line-height: 1.2;
}

#wq-popover .wq-current .hdr {
  font-weight: 700;
  margin-bottom: 6px;
}

#wq-popover .wq-current .kv {
  display: grid;
  grid-template-columns: 50px auto; /* label takes remaining space, value hugs content */
  column-gap: 8px;
  margin: 2px 0;
}


#wq-popover .wq-current .k {
  opacity: 0.85;
}

#wq-popover .wq-current .v {
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  
}


#wq-popover .title {
  font-weight: 700;
  margin-bottom: 5px;
  white-space: nowrap;
  text-align: center;
}

#wq-popover .muted {
  opacity: 0.75;
  text-align: center;
}

/* Hourly rows */
#wq-popover .wq-row {
  display: grid;
  grid-template-columns: 54px 52px 32px 50px 54px; // middle column is a spacer for the moon.
  gap: 4px 10px;
  align-items: center;
  padding: 0;
  border-radius: 0;
  position: relative;        /* anchor for moon */
}

#wq-popover .head {
  font-weight: 700;
  opacity: 0.75;
  text-align: center;
}

/* Time column alignment */
#wq-popover .wq-row > div:first-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#wq-popover .sunline {
  white-space: nowrap;
  text-align: center;
}

/* ---------- Time emphasis ---------- */
#wq-popover .wq-row.past   { opacity: 0.70; }
#wq-popover .wq-row.future { opacity: 0.88; }

#wq-popover .wq-row.current {
  color: #111;
  font-weight: 600;
  opacity: 1;
}

#wq-popover .wq-row.current > div:nth-child(2) {
  font-weight: 700;
}

/* Temp stays centered */
#wq-popover .wq-row > div:nth-child(2) {
  text-align: center;
}

/* Precip and Wind aligned */
#wq-popover .wq-row > div:nth-child(4) {
  text-align: right;
},
#wq-popover .wq-row > div:nth-child(5) {
  text-align: right;
}

/* Use tabular numbers for clean alignment */
#wq-popover .wq-row {
  font-variant-numeric: tabular-nums;
}

/* Precip column cell */
#wq-popover .precip-cell {
  display: flex;
  justify-content: center;  /* center whole block in column */
}

/* Align the % value itself to the right */
#wq-popover .precip-cell span {
  min-width: 28px;          /* gives numbers equal visual width */
  text-align: right;
}

/* ----- Wind ----- */
#wq-popover .wind-cell {
  display: flex;
  justify-content: center;   /* center block in column */
  gap: 4px;                  /* small space between speed and direction */
}

#wq-popover .wind-speed {
  min-width: 22px;           /* aligns numbers */
  text-align: right;
}

#wq-popover .wind-dir {
  text-align: left;
}






/* =========================================================
   Vertical shading overlay support
   (JS inserts .wq-shade blocks inside .wq-rows)
   ========================================================= */

#wq-popover .wq-rows {
  position: relative; /* anchor for absolute overlay blocks */
}

#wq-popover .wq-shade {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
}

/* Ensure row content stays above the overlay blocks */
#wq-popover .wq-row {
  position: relative;
  z-index: 1;
}

/* =========================================================
   Moon Overlay (FIXED)
   ========================================================= */

/* IMPORTANT:
   Apply z-index/positioning ONLY to real grid cells,
   NOT to the moon overlay.
*/
#wq-popover .wq-row > div:not(.wq-moon) {
  position: relative;
  z-index: 1;
}

/* Moon centered between Temp and Precip (absolute inside .wq-rows)
   JS sets top in px so the MOON CENTER is at midnight↔sunrise midpoint.
*/
#wq-popover .wq-rows > .wq-moon-layer {
  position: absolute;

  /* Start at left edge of Temp column + its width */
  left: 0;

  top: 0; /* set by JS */
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 50;

  width: 36px;
  height: 36px;
  opacity: 0.76;
}


/* ---------- Settings Page ---------- */
.settings-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 12px 18px;
}

.settings-card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  background: transparent;
}

.settings-card fieldset {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin: 0 0 12px;
}

.settings-card legend {
  padding: 0 6px;
  font-size: 0.92em;
  color: #333;
}

.settings-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 8px 0;
}

.settings-row label {
  font-size: 0.92em;
}

.settings-row input[type="text"] {
  padding: 6px 8px;
  font-size: 0.95em;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  width: 180px;
  max-width: 100%;
}

.settings-radio {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-radio label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-note {
  color: #666;
  font-size: 0.85em;
  margin-top: 6px;
  line-height: 1.25;
}

.settings-msg {
  margin: 6px 12px 0;
  font-size: 0.9em;
  color: #1a7f37;
}

.settings-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}

.settings-actions button {
  background: #0b70c9;
  color: #fff;
  border: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.95em;
  cursor: pointer;
}

.settings-actions button:hover { opacity: 0.92; }

.settings-actions a {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #0b70c9;
  border: 1px solid #cfdff0;
  background: #f6fbff;
}

/* Two-column layout for fieldsets (label on left, controls on right) */
.settings-two-col legend {
  /* keep for screen readers, hide visually */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.settings-two-col .two-col {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.settings-two-col .two-col-left {
  flex: 0 0 220px;   /* tweak to taste */
}

.settings-two-col .two-col-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.settings-two-col .two-col-hint {
  opacity: 0.8;
  font-size: 0.95em;
  line-height: 1.25;
}

.settings-two-col .two-col-right {
  flex: 1 1 auto;
}

.settings-two-col .radio-row {
  display: flex;
  align-items: center;
  gap: 18px;
}


.settings-two-col .radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
  margin-bottom: 6px; /* allows wrap */
}

/* Responsive: stack on narrow widths */
@media (max-width: 640px) {
  .settings-two-col .two-col {
    flex-direction: column;
    gap: 10px;
  }
  .settings-two-col .two-col-left {
    flex: 1 1 auto;
  }
}

/* ---------- Legend tooltip (hover + focus) ---------- */
.legend-tip { padding: 0; }

.legend-tip .tip {
  position: relative;
  display: inline-block;
  cursor: help;
  outline: none;
  border-bottom: 1px dotted rgba(0,0,0,0.45);
}

.legend-tip .tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: 120%;
  z-index: 50;

  width: max-content;
  max-width: 320px;

  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);

  background: rgba(255,255,255,0.97);
  color: inherit;
  line-height: 1.25;
  font-size: 0.95em;

  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.legend-tip .tip:hover::after,
.legend-tip .tip:focus::after {
  opacity: 1;
  transform: translateY(0);
}

/* Keep tooltip from running off-screen on narrow widths */
@media (max-width: 640px) {
  .legend-tip .tip::after { max-width: 260px; }
}

.settings-actions a:hover { text-decoration: none; opacity: 0.92; }

.settings-hidden { display: none !important; }

/* ---------- Settings Page: Embedded (compact) ---------- */
body.embed .page-header { padding: 4px 10px; }

body.embed .settings-wrap {
  padding: 6px 10px 10px;
}

body.embed .settings-card {
  padding: 10px;
}

body.embed .settings-card fieldset {
  margin: 0 0 8px;
  padding: 8px 10px 10px;
}

body.embed .settings-row {
  margin: 6px 0;
}

body.embed .settings-actions {
  margin-top: 6px;
}

/* --- compact tooltip --- */
.wq-tip{
  display:inline-block;
  margin-left:6px;
  width:18px;
  height:18px;
  line-height:18px;
  text-align:center;
  border-radius:50%;
  border:1px solid rgba(0,0,0,0.35);
  font-size:12px;
  cursor:help;
  user-select:none;
  position:relative;
  opacity:0.85;
}

.wq-tip:hover,
.wq-tip:focus{
  opacity:1;
}

.wq-tip:hover::after,
.wq-tip:focus::after{
  content: attr(aria-label);
  position:absolute;
  left:50%;
  top:125%;
  transform:translateX(-50%);
  background:rgba(20,20,20,0.95);
  color:#fff;
  padding:8px 10px;
  border-radius:8px;
  font-size:12px;
  line-height:1.25;
  white-space:normal;
  width:260px;
  max-width:80vw;
  z-index:9999;
  box-shadow:0 6px 20px rgba(0,0,0,0.25);
}

.wq-tip:hover::before,
.wq-tip:focus::before{
  content:"";
  position:absolute;
  left:50%;
  top:112%;
  transform:translateX(-50%);
  border:6px solid transparent;
  border-bottom-color:rgba(20,20,20,0.95);
  z-index:9999;
}

.wq-toast{
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  max-width: 240px;      /* <-- key: hard cap */
  padding: 8px 14px;     /* tighter padding */

  background: rgba(40,40,40,0.95);
  color: #fff;
  border-radius: 999px;  /* pill shape */
  font-size: 13px;
  text-align: center;
  white-space: normal;   /* allow wrap if needed */

  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}





@keyframes wq-toast-in {
  from { transform: translateY(-6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}


