/* AtlasDays day calendar (assets/js/day-calendar.js). Modelled on the app's
   calendar view: continuous week rows, the month name on the 1st, today as an
   accent pill, trips as bars in the app's trip blue, a faint disc on days
   without a trip, other months dimmed. The result spans the top; calendar and
   trips sit side by side at equal width, stacked on a phone.

   Colours (Jorick, 2026-09-30), all from the app's trip blue #5B9ED9:
     hover over a free day   25% blue circle (mouse only)
     first day of a new trip solid blue circle
     preview while choosing  50% blue bar (mouse only)
     a trip                  solid blue bar
     the selected trip       darker #3F7FC0, white drag handles on its ends */

.daycal {
  --cal-bar: #5B9ED9;
  --cal-sel: #3F7FC0;
  --cal-hover: rgba(91, 158, 217, 0.25);
  --cal-disc: rgba(255, 255, 255, 0.07);
  /* the app's tracker tones (iOS system colours) */
  --tone-normal: #5B9ED9;
  --tone-warning: #FF9F0A;
  --tone-critical: #FF453A;
  --tone-achieved: #30D158;
  --cal-track: rgba(120, 120, 128, 0.32);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "settings settings" "result result" "hint hint" "cal trips";
}
.daycal.has-floating-hint { grid-template-areas: "settings settings" "result result" "cal trips"; }
.daycal {
  gap: 14px;
  align-items: start;
  margin: 18px 0 14px;
}
html[data-theme="light"] .daycal { --cal-disc: rgba(12, 22, 40, 0.07); --tone-warning: #FF9500; --tone-critical: #FF3B30; --tone-achieved: #34C759; --cal-track: rgba(120, 120, 128, 0.2); }
.cal-side { display: contents; }
.cal-side > .cal-box:first-child { grid-area: result; }
.cal-side > .cal-box:last-child { grid-area: trips; }
/* A long timeline scrolls inside its card, so the page keeps its height. */
/* The cards bleed 8px past the text for their highlight; the list makes room
   for that bleed, so it can hide sideways scrolling without clipping them. */
[data-cal-list] { max-height: 430px; overflow-y: auto; overflow-x: hidden; margin: 0 -8px; padding: 0 8px; }

.cal-hint { grid-area: hint; margin: 0; color: var(--muted); font-size: 0.93rem; }
/* a quiet hint floats at the bottom of the calendar window instead of taking
   a row, so the cards keep even gaps and nothing moves when it appears */
.cal-hint.is-floating {
  position: sticky;
  bottom: 10px;
  z-index: 4;
  margin: 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 0.86rem;
}
/* the rule's choices, above the tracker card: a settings card of rows,
   label left and choice right, as in the app's tracker editor */
.cal-settings {
  grid-area: settings;
  padding: 2px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
}
.cal-settings { padding: 6px 16px; }
.cal-setting { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.cal-setting > .cal-icon { color: var(--cal-bar); }
.cal-setting-label { color: var(--text); font-size: 0.95rem; font-weight: 500; }
.cal-setting .cal-control { margin-left: auto; }
.cal-setting-caption { margin: -4px 0 8px 32px; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }

/* line icons (after the app's SF Symbols) */
.cal-icon { display: inline-flex; flex: 0 0 auto; width: 20px; height: 20px; }
.cal-icon svg { width: 100%; height: 100%; }
/* a choice reads as accent text with a small chevron; the native menu sits
   invisibly over it, so a tap opens the system list */
.cal-control.is-select, .cal-control.is-date { position: relative; }
.cal-value { display: inline-flex; align-items: center; gap: 3px; color: var(--cal-bar); font-size: 0.95rem; font-weight: 600; white-space: nowrap; }
.cal-chevron { width: 13px; height: 13px; }
.cal-control.is-select select, .cal-control.is-date input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
/* Safari sizes a native select to its longest option (and a date field to its
   own minimum) unless its native look is off, and that box then widens the
   page on iPhone. The invisible controls take exactly their label's size. */
.cal-control.is-select select, .cal-control.is-date input {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  min-width: 0; max-width: 100%; margin: 0; padding: 0; border: 0; background: none; font-size: 16px;
}
.cal-settings { overflow: hidden; }
.cal-control.is-select:focus-within .cal-value, .cal-control.is-date:focus-within .cal-value { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.cal-window {
  grid-area: cal;
  position: relative;
  height: 548px;
  overflow-y: auto; /* no overscroll containment: at either end the page scrolls on */
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
}

.cal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 0 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
}
.cal-month-title { margin: 0 0 10px 16px; color: var(--text); font-size: 1rem; font-weight: 650; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0 0 8px; }
.cal-weekdays span { color: var(--muted-2); font-size: 0.7rem; font-weight: 600; text-align: center; }

.cal-week {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  height: 72px;
  border-top: 1px solid var(--line);
}
.cal-week:first-child { border-top: 0; }
/* the month in view: an accent line over its days, 3px at 28%, as in the app */
.cal-month-line { position: absolute; top: -2px; height: 3px; background: color-mix(in srgb, var(--cal-bar) 28%, transparent); pointer-events: none; }

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  height: 100%;
  padding: 7px 0 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.cal-day:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 8px; }
.cal-num {
  display: inline-block;
  min-width: 28px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 22px;
  text-align: center;
}
.cal-day.is-other-month .cal-num { color: var(--muted-2); font-weight: 500; }
.cal-day.is-month-start .cal-num { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; }
.cal-day.is-today .cal-num { background: var(--blue); color: #fff; }

/* the disc on the bar line of a day with no trip: the tap target */
.cal-day::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 36px;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: var(--cal-disc);
}
.cal-day.has-trip::after { display: none; }
@media (hover: hover) and (pointer: fine) { .cal-day:not(.has-trip):hover::after { background: var(--cal-hover); } }
/* also while the mouse is still on it, so the click shows at once */
.cal-day.is-anchor::after, .cal-day.is-anchor:not(.has-trip):hover::after { display: block; z-index: 2; background: var(--cal-bar); }

.cal-bars { position: absolute; left: 0; right: 0; top: 36px; height: 20px; z-index: 1; pointer-events: none; }
.cal-bar { position: absolute; top: 0; height: 20px; background: var(--cal-bar); }
.cal-bar.starts { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.cal-bar.ends { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.cal-bar.is-preview { background: color-mix(in srgb, var(--cal-bar) 50%, var(--bg-card)); }
.cal-bar.is-selected { background: var(--cal-sel); }
/* the trip's flag on the start of its bar: bar height, the app's 0.7 ratio */
.cal-bar-flag {
  position: absolute;
  top: 0;
  width: 28px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* Drag handles on the selected trip: 22px to see, 44px to touch. */
.cal-handle {
  position: absolute;
  top: -1px;
  z-index: 3;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--cal-sel), 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
}
.cal-handle::before { content: ""; position: absolute; inset: -11px; border-radius: 50%; }
.daycal.is-dragging, .daycal.is-dragging * { cursor: ew-resize !important; user-select: none; }
.cal-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
}

/* menus a rule puts in the result box, e.g. "Days in [Spain] [2026]" */
.cal-controls { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 12px; }
.cal-control { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 0.9rem; }
.cal-control select {
  max-width: 100%;
  padding: 6px 30px 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235B9ED9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
/* the country being checked: its flag and a type-ahead field in one pill */
.cal-control.is-country .cal-control-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
}
.cal-control.is-country .cal-flag { width: 24px; height: 18px; border-radius: 3px; }
.cal-control.is-country .cal-country-input { width: 11em; margin: 0; padding: 3px 0; border: 0; background: transparent; font-weight: 650; }
.cal-control.is-country .cal-country-input:focus { background: transparent; }
.cal-control.is-date input { color-scheme: light dark; }

/* the result as the app's tracker card: flag and title with the status pill,
   then period and count, then the bar */
.cal-card-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.cal-card-head .cal-flag { width: 28px; height: 21px; }
.cal-card-title { flex: 1 1 auto; min-width: 0; color: var(--text); font-size: 1.02rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-card-title.is-placeholder { color: var(--muted); font-weight: 500; }
.cal-card-head .cal-pill { flex: 0 0 auto; margin: 0 0 0 auto; }
/* the country picker as the card's title */
.cal-card-head .cal-control.is-country { flex: 1 1 auto; min-width: 0; }
.cal-card-head .cal-control.is-country .cal-control-pill { padding: 0; border: 0; background: none; gap: 10px; }
.cal-card-head .cal-control.is-country .cal-flag { width: 28px; height: 21px; border-radius: 4px; }
.cal-card-head .cal-control.is-country .cal-control-pill { min-width: 0; max-width: 100%; }
.cal-card-head .cal-control.is-country .cal-country-field { min-width: 0; }
.cal-card-head .cal-control.is-country .cal-country-input { max-width: min(18em, 60vw); padding: 3px 6px; margin-left: -6px; border: 1px solid transparent; border-radius: 8px; font-size: 1.02rem; text-overflow: ellipsis; }
.cal-card-head .cal-control.is-country .cal-country-input:hover { border-color: transparent; background: color-mix(in srgb, var(--cal-bar) 10%, transparent); }
.cal-measure { position: absolute; visibility: hidden; white-space: pre; }
.cal-card-head .cal-control.is-country .cal-country-input:focus { border-color: var(--blue); }
.cal-meter { display: grid; gap: 7px; margin: 2px 0 10px; }
.cal-meter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cal-meter-period { color: var(--muted); font-size: 0.9rem; }
.cal-meter-count { color: var(--muted); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-meter-count b { color: var(--text); }
.cal-meter-track { height: 10px; border-radius: 999px; background: var(--cal-track); overflow: hidden; }
.cal-meter-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 75%, transparent)); transition: width 0.2s ease; }
.cal-meter, .cal-pill { --tone: var(--tone-normal); }
.tone-warning { --tone: var(--tone-warning); }
.tone-critical { --tone: var(--tone-critical); }
.tone-achieved { --tone: var(--tone-achieved); }
.cal-meter:not(.tone-normal) .cal-meter-count b { color: var(--tone); }
.cal-pill {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 15%, transparent);
  color: var(--tone);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* days outside the chosen period: shown for the week's sake, not tappable */
.cal-day.is-outside { cursor: default; }
.cal-day.is-outside .cal-num { opacity: 0.28; }
.cal-day.is-outside::after { display: none; }
.cal-trip.is-outside { opacity: 0.45; }

.cal-result-head { display: grid; gap: 8px; justify-items: start; margin: 0 0 8px; }
.cal-headline { margin: 0; color: var(--text); font-size: 1rem; font-weight: 650; line-height: 1.35; }
.cal-status { padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 650; white-space: nowrap; color: var(--text); }
.cal-status.is-ok { background: rgba(52, 168, 83, 0.16); }
.cal-status.is-over { background: rgba(217, 83, 79, 0.18); }
.cal-line { margin: 0 0 4px; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

.cal-import {
  width: 100%;
  margin: 12px 0 0;
  padding: 9px 12px;
  border: 1px solid rgba(66, 143, 210, 0.45);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.cal-box h3 { margin: 0 0 4px; font-size: 0.95rem; }
.cal-empty { margin: 4px 0 0; color: var(--muted); font-size: 0.86rem; }
/* A trip card, as the app shows one:
     [flag]  Country (or a field to add one)
             1 – 10 Jul 2026                    9 days away   */
.cal-trip {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas: "flag country" "flag line";
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  margin: 0 -8px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.cal-trip:first-child { border-top-color: transparent; }
.cal-trip.is-selected { background: rgba(91, 158, 217, 0.12); box-shadow: inset 0 0 0 1px rgba(91, 158, 217, 0.5); border-top-color: transparent; }
.cal-trip.is-selected + .cal-trip { border-top-color: transparent; }
.cal-flag {
  grid-area: flag;
  width: 28px;
  height: 21px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}
.cal-flag img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cal-flag.is-empty { background: var(--cal-disc); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.cal-trip-country { grid-area: country; min-width: 0; font-size: 0.92rem; font-weight: 650; }
/* One fixed line height, so Delete replacing the day count never moves the card. */
.cal-trip-line { grid-area: line; display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 24px; }
.cal-trip .cal-country-field { display: inline-block; max-width: 100%; vertical-align: top; }
.cal-trip .cal-country-input { max-width: 100%; }
.cal-trip-dates { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.cal-trip-count { color: var(--muted-2); font-size: 0.82rem; white-space: nowrap; }
.cal-delete {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin: 0;
  height: 24px;
  box-sizing: border-box;
  padding: 0 10px 0 8px;
  line-height: 1;
  border: 1px solid rgba(217, 83, 79, 0.45);
  border-radius: 999px;
  background: rgba(217, 83, 79, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.cal-delete .cal-icon { width: 14px; height: 14px; color: #E5534B; }

/* The country: a type-ahead field that reads like plain text until focused. */
.cal-country-field { position: relative; }
.cal-country-input {
  width: 100%;
  margin: -3px 0 -3px -6px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 650;
}
/* Safari's contact AutoFill button would sit inside the field and eat its width */
.cal-country-input::-webkit-contacts-auto-fill-button,
.cal-country-input::-webkit-credentials-auto-fill-button { visibility: hidden; display: none !important; pointer-events: none; width: 0; }
.cal-country-input::placeholder { color: var(--blue); font-weight: 600; opacity: 1; }
.cal-country-input:hover { border-color: var(--line); }
.cal-country-input:focus { border-color: var(--blue); background: var(--bg); outline: none; font-weight: 500; }
.cal-country-list {
  position: fixed; /* placed by the engine, so no scrolling card clips it */
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.cal-country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.cal-country-option img { flex: 0 0 auto; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.cal-country-option.is-active, .cal-country-option:hover { background: rgba(91, 158, 217, 0.16); }
.cal-country-none { padding: 7px 8px; color: var(--muted); font-size: 0.86rem; }

.cal-private { margin: 0 0 26px; color: var(--muted-2); font-size: 0.82rem; }

/* Import to AtlasDays */
.cal-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-card);
  color: var(--text);
}
.cal-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.cal-dialog-title { margin: 0 0 6px; font-size: 1.1rem; font-weight: 650; }
.cal-dialog p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.cal-dialog ol { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.cal-dialog li { margin: 0 0 6px; }
.cal-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-dialog-actions button,
.cal-dialog-actions a {
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.cal-dialog [data-cal-download] { border: 1px solid rgba(66, 143, 210, 0.45); background: var(--blue); color: #fff; }
.cal-dialog-app { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
/* The Open in AtlasDays dialog: Open (or the QR code) leads, the file is the
   alternative, unless the file is all there is. */
.cal-dialog-primary,
.cal-dialog.is-file [data-cal-download] { border: 1px solid rgba(66, 143, 210, 0.45); background: var(--blue); color: #fff; }
.cal-dialog [data-cal-on] .cal-dialog-actions { margin: 0 0 14px; }
.cal-dialog-primary { display: inline-block; }
.cal-dialog .cal-dialog-note { font-size: 0.84rem; }
.cal-dialog-note a { color: var(--blue); }
/* The step-by-step dialog (183-day calculator): the app icon and a one-line
   pitch, then numbered steps; the file is a quiet link in the footer. */
.cal-dialog-steps { width: min(540px, calc(100vw - 32px)); padding: 20px 22px 16px; }
.cal-dialog-steps:focus { outline: none; }
.cal-dialog-steps [hidden] { display: none !important; }
.cal-dialog-steps .cal-dialog-title { color: var(--text); }
.cal-dialog-head { display: flex; gap: 12px; align-items: center; margin: 0 0 16px; }
.cal-dialog-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.cal-dialog-steps .cal-dialog-title { margin: 0; }
.cal-dialog-steps .cal-dialog-sub { margin: 2px 0 0; font-size: 0.88rem; }
.cal-dialog-scan { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: 0 0 6px; }
.cal-dialog-scan .cal-qr { margin: 0; flex: none; }
.cal-dialog-scan.is-large { flex-direction: column; align-items: flex-start; }
/* Code above the steps: it lines up with the text, not the dialog edge
   (title after the 44px icon + 12px gap; step text after the 34px number). */
.cal-dialog-scan.is-stacked .cal-qr { margin-left: 56px; max-width: calc(100% - 56px); }
/* Step text starts where the title does: 22px + the 34px number column. */
.cal-dialog .cal-steps { padding: 0 0 0 22px; }
.cal-dialog-scan .cal-steps { flex: 1 1 200px; }
.cal-steps { list-style: none; counter-reset: cal-step; margin: 0 0 6px; padding: 0; }
.cal-steps > li { counter-increment: cal-step; position: relative; padding: 0 0 14px 34px; margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.cal-steps > li::before {
  content: counter(cal-step); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(91, 158, 217, 0.18); color: var(--blue); font-size: 0.78rem; font-weight: 700;
}
.cal-steps.is-single > li { padding-left: 0; }
.cal-steps.is-single > li::before { content: none; }
.cal-steps > li > strong { display: block; color: var(--text); font-size: 0.95rem; font-weight: 650; }
.cal-steps > li > span { display: block; margin: 1px 0 0; }
.cal-steps > li > a, .cal-steps > li > button { display: inline-block; margin: 9px 0 0; padding: 8px 16px; border-radius: 999px; font: inherit; font-size: 0.88rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.cal-dialog-store { border: 1px solid var(--line-strong); color: var(--text); }
.cal-dialog-foot { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0 0; }
.cal-dialog-foot p { margin: 0; flex: 1; font-size: 0.86rem; }
.cal-dialog-steps .cal-dialog-foot .cal-dialog-link { padding: 0; border: 0; border-radius: 0; background: none; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.cal-dialog-foot [data-cal-close] { padding: 6px 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 650; cursor: pointer; }
.cal-qr { width: 208px; max-width: 100%; margin: 2px 0 16px; border-radius: 14px; overflow: hidden; background: #ebebeb; }
.cal-qr:empty { aspect-ratio: 1; }
.cal-qr svg { display: block; width: 100%; height: auto; }
.cal-dialog [data-cal-close] { margin-left: auto; border: 0; background: none; color: var(--muted); }

/* On a phone: hint, result, calendar, trips, one under the other. */
@media (max-width: 640px) {
  [data-cal-list] { max-height: min(380px, 55vh); }
  .daycal { grid-template-columns: minmax(0, 1fr); grid-template-areas: "settings" "result" "hint" "cal" "trips"; }
  .daycal.has-floating-hint { grid-template-areas: "settings" "result" "cal" "trips"; }
  .cal-window { height: min(50vh, 460px); } /* leaves page to swipe on above and below */
  .cal-country-input, .cal-control select { font-size: 16px; } /* keeps iOS from zooming in on focus */
}

/* Japanese breaks at phrase boundaries where the browser can (Chrome, Edge). */
html:lang(ja) .cal-dialog-steps { word-break: auto-phrase; }

/* A link to an article's #calculator lands below the sticky site header. */
#calculator { scroll-margin-top: 96px; }
