/* Inter, served from this site (fonts/). Licence in fonts/LICENSE.txt */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Inter-Bold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/Inter-ExtraBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 900; font-display: swap; src: url("fonts/Inter-Black.woff") format("woff"); }

/* Layout: a calm photo-library shell. The colours of the sky are the only loud thing on the page. */
:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --fg: #0f1720;
  --muted: #5a6877;
  --hair: #dce3eb;
  --focus: #2a73d6;
  --veil: rgba(6, 9, 14, 0.97);
  --veil-ink: #f2f5f9;
  --stamp-ink: #ffffff;
  --stamp-shade: rgba(0, 0, 0, 0.5);
  --display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --gutter-top: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1017;
    --surface: #151c26;
    --fg: #eef2f7;
    --muted: #94a3b5;
    --hair: #222c39;
    --focus: #6aa8ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1017;
  --surface: #151c26;
  --fg: #eef2f7;
  --muted: #94a3b5;
  --hair: #222c39;
  --focus: #6aa8ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button:focus-visible, .addbtn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
img { display: block; }

.wrap {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  padding-block: var(--gutter-top) 130px;
}

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; }
.brand { min-width: 0; font-family: var(--display); font-weight: 800; font-size: 1.25rem; line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.extras { flex: none; display: flex; align-items: center; gap: 8px; }

/* colour barcode: one stripe per calendar day */
.ribbon { display: flex; height: 34px; border-radius: 10px; overflow: hidden; background: var(--hair); gap: 0; }
.ribbon i { flex: 1 1 0; min-width: 0; background: var(--c); cursor: pointer; transition: opacity 0.2s; }
.ribbon i.none { background: transparent; cursor: default; }
.ribbon i.off { opacity: 0.22; }

/* banner: the average colour of whatever you are looking at */
.banner {
  --c: var(--surface); --ink: var(--fg);
  margin-top: 14px;
  background: var(--c); color: var(--ink);
  border-radius: 22px;
  padding: 18px 22px 22px;
  min-height: 168px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  position: relative;
}
.banner h1 { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(2.2rem, 9vw, 4rem); line-height: 1; letter-spacing: -0.045em; text-wrap: balance; }
.meta { margin: 0; font-family: var(--mono); font-weight: 500; font-size: 12.5px; letter-spacing: 0.02em; opacity: 0.85; }
.back { align-self: flex-start; margin-bottom: auto; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 16%, transparent); font-weight: 600; font-size: 13px; }
.banner:not(:has(.back)) { justify-content: flex-end; }

/* section headings */
.sec { display: flex; align-items: center; gap: 10px; margin: 30px 2px 10px; font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.01em; }
.sec .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.35); }
.sec small { margin-left: auto; font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); }

/* colour tiles (years, months, weeks) */
.tile {
  --c: var(--surface); --ink: var(--fg);
  background: var(--c); color: var(--ink);
  border-radius: 18px;
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 3px;
  min-height: 150px;
  transition: transform 0.18s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile .big { font-family: var(--display); font-weight: 900; font-size: clamp(2.6rem, 12vw, 4.6rem); line-height: 0.95; letter-spacing: -0.05em; }
.tile .name { font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.tile .meta { font-size: 11.5px; }
.tile .strip { margin-top: auto; padding-top: 14px; }
.strip { display: flex; gap: 1px; height: 18px; width: 100%; border-radius: 5px; overflow: hidden; }
.strip i { flex: 1 1 0; min-width: 0; background: var(--c); }
.strip i.none { background: rgba(127, 127, 127, 0.28); }

.years { display: grid; gap: 12px; margin-top: 14px; }
.years .tile { min-height: 160px; }
.years .strip { height: 26px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.weeks { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid.weeks .tile { min-height: 120px; }

/* day photos, tight like Photos */
.days { display: grid; gap: 2px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); border-radius: 12px; overflow: hidden; }
.cell { position: relative; aspect-ratio: 1; background: var(--c); overflow: hidden; }
.cell img { width: 100%; height: 100%; object-fit: cover; }
.cell::after { content: ""; position: absolute; inset: auto 0 0 0; height: 46%; background: linear-gradient(transparent, var(--stamp-shade)); pointer-events: none; }
.stamp { position: absolute; left: 8px; bottom: 6px; z-index: 1; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--stamp-ink); letter-spacing: 0.02em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

.empty { margin: 40px 2px; color: var(--muted); max-width: 46ch; }
.empty b { color: var(--fg); }
.proto-note { margin: 28px 2px 0; color: var(--muted); font-size: 13px; max-width: 60ch; }

/* floating tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; pointer-events: none;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.pill {
  pointer-events: auto; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--hair);
  box-shadow: 0 8px 30px rgba(8, 20, 40, 0.16);
}
.pill button { padding: 9px 17px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.pill button[aria-current="true"] { background: var(--fg); color: var(--bg); }

/* single photo view */
.lb {
  position: fixed; inset: 0; z-index: 30; background: var(--veil); color: var(--veil-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding-block: calc(56px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  overflow-y: auto;
}
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); display: grid; place-items: center; font-size: 20px; line-height: 1; text-align: center; }
.lb-photo { width: min(100%, 62vh, 620px); aspect-ratio: 1; border-radius: 14px; object-fit: cover; background: #222; }
.lb-bar { display: flex; align-items: center; gap: 14px; width: min(100%, 620px); }
.lb-bar h2 { flex: 1; margin: 0; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.01em; text-wrap: balance; }
.lb-nav { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); display: grid; place-items: center; font-size: 22px; flex: none; text-align: center; }
.lb-nav:disabled { opacity: 0.25; cursor: default; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(100%, 620px); }
.chip { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); min-width: 0; }
.chip span { display: block; height: 30px; border-radius: 7px; background: var(--c); }
.chip small { font-size: 11px; opacity: 0.7; }
.chip b { font-family: var(--mono); font-weight: 500; font-size: 12px; }
@media (max-width: 480px) { .chips { grid-template-columns: repeat(2, 1fr); } }

/* prototype-only upload control */
.addbtn { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 600; font-size: 13px; cursor: pointer; }
.datein { font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--hair); background: var(--surface); color: var(--fg); }
.boot { margin: 60px 0; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .tile, .pill button, .ribbon i { transition: none; }
  .tile:hover { transform: none; }
}

/* numbers line up */
.meta, .count, .stamp, .chip b, .sec small { font-variant-numeric: tabular-nums; }
.count { font-weight: 500; }

/* header link */
.aboutbtn { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--hair); background: var(--surface); font-weight: 700; font-size: 13px; }

/* about sheet */
.sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--veil); color: var(--veil-ink);
  display: grid; place-items: center; overflow-y: auto;
  padding-block: calc(60px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
.sheet-card { background: var(--surface); color: var(--fg); border-radius: 26px; padding: 28px; width: min(100%, 520px); display: flex; flex-direction: column; gap: 14px; }
.sheet-card h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 8vw, 2.8rem); letter-spacing: -0.045em; line-height: 1; }
.sheet-card p { margin: 0; max-width: 56ch; font-size: 16px; }
.sheet-link { align-self: flex-start; margin-top: 6px; padding: 11px 18px; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 800; text-decoration: none; }
.sheet-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* total pill (top right) and the all-skies sheet */
.totalbtn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--hair); background: var(--surface); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.totalbtn .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.35); }
.sheet-card .banner { margin: 0; min-height: 130px; }
.sheet-card .banner h1 { font-size: clamp(2rem, 10vw, 3rem); }
.sheet-card .ribbon { height: 64px; }
.sheet-note { color: var(--muted); font-size: 13px !important; }

/* phones: keep the title and both pills on one row */
@media (max-width: 480px) {
  .brand { font-size: 1.1rem; }
  .extras { gap: 6px; }
  .aboutbtn, .totalbtn { padding: 7px 12px; font-size: 12.5px; }
}
