/* ------------------------------------------------------------------
   Family Portal — visual identity
   The subject is a household noticeboard: the fridge door where the
   calendar, the school letter and the holiday photo all live together.
   Each person owns a colour, and that colour follows them everywhere.
------------------------------------------------------------------- */

:root {
  --porcelain: #F3F4F1;
  --card: #FFFFFF;
  --ink: #16202B;
  --ink-soft: #5D6975;
  --rule: #DCE0DA;
  --tape: rgba(226, 214, 168, 0.75);

  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --body: "Karla", "Segoe UI", system-ui, sans-serif;
  --utility: "Space Mono", ui-monospace, "Courier New", monospace;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 43, .06), 0 8px 24px rgba(22, 32, 43, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--porcelain);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 .5rem;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------------------------------------------------------- masthead */
.masthead {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
}

.masthead .wrap {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 62px; flex-wrap: wrap;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  display: flex; align-items: center; gap: .5rem;
}

.brand .dots { display: flex; gap: 3px; }
.brand .dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }

nav.primary { display: flex; gap: .35rem; flex-wrap: wrap; margin-left: auto; }

nav.primary a {
  text-decoration: none;
  font-size: .93rem;
  padding: .35rem .7rem;
  border-radius: 99px;
  color: var(--ink-soft);
}

nav.primary a:hover { background: var(--porcelain); color: var(--ink); }
nav.primary a.on { background: var(--ink); color: #fff; }

nav.primary a .badge {
  background: var(--magnet, #E23E57); color: #fff;
  border-radius: 99px; padding: 0 .4rem; margin-left: .3rem;
  font-family: var(--utility); font-size: .72rem;
}

.whoami {
  display: flex; align-items: center; gap: .5rem;
  padding-left: .9rem; border-left: 1px solid var(--rule);
}

.pip {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--utility); font-size: .72rem; font-weight: 700;
  color: #fff; flex: none;
}

.pip.sm { width: 22px; height: 22px; font-size: .6rem; }

/* ---------------------------------------------------------- structure */
main { padding: 2rem 0 4rem; }

.section-head {
  display: flex; align-items: baseline; gap: 1rem;
  margin: 2.4rem 0 1rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--ink);
}
.section-head:first-child { margin-top: 0; }
.section-head .more { margin-left: auto; font-size: .9rem; }

.eyebrow {
  font-family: var(--utility);
  font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
}

.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.card.flush { padding: 0; overflow: hidden; }

/* -------------------------------------------------- signature: the door */
.door { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.5rem; align-items: start; }

@media (max-width: 820px) { .door { grid-template-columns: 1fr; } }

.album {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 12px 52px;
  box-shadow: var(--shadow);
  transform: rotate(-1.1deg);
}

.album::before {
  content: ""; position: absolute; top: -11px; left: 50%;
  width: 78px; height: 20px; transform: translateX(-50%) rotate(1.6deg);
  background: var(--tape);
  border-left: 1px solid rgba(0,0,0,.05); border-right: 1px solid rgba(0,0,0,.05);
  box-shadow: 0 1px 2px rgba(22,32,43,.09);
}

.album .frame {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: 6px; background: #E7E9E4;
}

.album .frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .9s ease;
}

.album .frame img.showing { opacity: 1; }

.album .caption {
  position: absolute; left: 18px; right: 18px; bottom: 14px;
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-size: 1rem;
}

.album .empty {
  display: grid; place-items: center; height: 100%;
  color: var(--ink-soft); font-size: .92rem; text-align: center; padding: 1rem;
}

/* countdown tiles — the other half of the door */
.countdown { display: grid; gap: .55rem; }

.tile {
  display: grid; grid-template-columns: 74px 1fr; align-items: center;
  background: var(--card); border: 1px solid var(--rule);
  border-left: 6px solid var(--magnet, var(--ink));
  border-radius: 10px; overflow: hidden;
  text-decoration: none;
}

.tile .days {
  font-family: var(--utility); text-align: center; padding: .6rem .2rem;
  line-height: 1;
}

.tile .days b { display: block; font-size: 1.55rem; letter-spacing: -.05em; }
.tile .days span { font-size: .62rem; text-transform: uppercase; color: var(--ink-soft); letter-spacing: .1em; }
.tile .what { padding: .6rem .8rem .6rem 0; }
.tile .what strong { display: block; font-size: .97rem; font-weight: 600; }
.tile .what small { color: var(--ink-soft); font-size: .8rem; }
.tile.soon .days b { color: var(--magnet, var(--ink)); }

/* ---------------------------------------------------------- lists */
.stack { display: grid; gap: .7rem; }

.row {
  display: flex; gap: .85rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 10px; padding: .85rem 1rem;
}

.row .bar {
  width: 4px; align-self: stretch; border-radius: 99px;
  background: var(--magnet, var(--ink)); flex: none;
}

.row .grow { flex: 1; min-width: 0; }
.row h3 { margin-bottom: .15rem; }

.meta {
  font-family: var(--utility); font-size: .76rem;
  color: var(--ink-soft); letter-spacing: .03em;
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
}

.chip {
  display: inline-block; font-family: var(--utility); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .08em;
  padding: .12rem .45rem; border-radius: 4px;
  background: var(--porcelain); border: 1px solid var(--rule); color: var(--ink-soft);
}

.chip.solid { background: var(--magnet, var(--ink)); color: #fff; border-color: transparent; }
.chip.warn { background: #FDF2D8; border-color: #EBD79A; color: #7A5A08; }

/* ---------------------------------------------------------- photos */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }

.snap {
  background: var(--card); padding: 10px 10px 14px;
  border-radius: 4px; box-shadow: var(--shadow);
}
.snap:nth-child(3n+1) { transform: rotate(-1deg); }
.snap:nth-child(3n+2) { transform: rotate(.8deg); }
.snap img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; display: block; }
.snap figcaption { font-size: .85rem; margin-top: .55rem; display: flex; gap: .4rem; align-items: center; }

/* ---------------------------------------------------------- forms */
.form { display: grid; gap: 1rem; max-width: 560px; }
.field { display: grid; gap: .3rem; }

label { font-size: .87rem; font-weight: 700; }
.hint { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], select, textarea {
  font: inherit; font-size: .96rem;
  padding: .6rem .7rem;
  border: 1px solid #C6CCC4; border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%;
}

textarea { min-height: 8rem; resize: vertical; line-height: 1.55; }

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 3px solid #1E8FA8; outline-offset: 2px;
}

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 520px) { .two-up { grid-template-columns: 1fr; } }

button, .btn {
  font: inherit; font-weight: 700; font-size: .93rem;
  padding: .55rem 1.05rem; border-radius: 8px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  cursor: pointer; text-decoration: none; display: inline-block;
}

button:hover, .btn:hover { background: #24313F; }

.btn.quiet, button.quiet {
  background: transparent; color: var(--ink); border-color: #C6CCC4;
}
.btn.quiet:hover, button.quiet:hover { background: #fff; }

button.link {
  background: none; border: none; color: var(--ink-soft);
  padding: 0; font-size: .8rem; font-weight: 400; text-decoration: underline;
}
button.link:hover { color: var(--ink); background: none; }

.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------- flashes */
.flash {
  border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem;
  font-size: .92rem; border: 1px solid;
}
.flash.ok { background: #E8F5EC; border-color: #B6DDC3; color: #1B5D33; }
.flash.error { background: #FDECEE; border-color: #F3C0C7; color: #8E1B2C; }

/* ---------------------------------------------------------- gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; }
.gate .panel { width: 100%; max-width: 400px; }
.gate .lockup { text-align: center; margin-bottom: 1.6rem; }
.gate .lockup .dots { display: flex; gap: 5px; justify-content: center; margin-bottom: .8rem; }
.gate .lockup .dots i { width: 13px; height: 13px; border-radius: 50%; }
.gate .lockup p { color: var(--ink-soft); font-size: .93rem; margin: .3rem 0 0; }

.code-input {
  font-family: var(--utility) !important;
  font-size: 1.5rem !important; letter-spacing: .35em;
  text-align: center;
}

.secret {
  font-family: var(--utility); font-size: .84rem; word-break: break-all;
  background: var(--porcelain); border: 1px dashed #B9C0B6;
  padding: .6rem .7rem; border-radius: 8px;
}

.qr { display: block; width: 190px; height: 190px; margin: 0 auto; image-rendering: pixelated; }

/* ---------------------------------------------------------- polls */
.bar-track {
  height: 26px; background: var(--porcelain); border-radius: 6px;
  border: 1px solid var(--rule); overflow: hidden; position: relative;
}
.bar-fill { height: 100%; background: var(--magnet, var(--ink)); opacity: .85; }
.bar-label {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 .55rem;
  font-size: .85rem; font-weight: 600;
}
.bar-label span:last-child { font-family: var(--utility); font-size: .78rem; }

.choice {
  display: flex; gap: .6rem; align-items: center;
  padding: .5rem .7rem; border: 1px solid var(--rule);
  border-radius: 8px; background: #fff; cursor: pointer; font-size: .95rem;
}
.choice:hover { border-color: var(--ink); }
.choice input { accent-color: var(--ink); }

.empty-state {
  border: 2px dashed #C9CFC6; border-radius: var(--radius);
  padding: 2.2rem 1.5rem; text-align: center; color: var(--ink-soft);
}
.empty-state h3 { color: var(--ink); }

.prose { max-width: 42rem; font-size: 1.05rem; }
.prose p { margin: 0 0 1.1rem; white-space: pre-wrap; }

footer.foot {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.4rem 0;
  font-size: .82rem; color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .album, .snap { transform: none; }
}

/* ---------------------------------------------------------- small screens */
@media (max-width: 760px) {
  .masthead { position: static; }
  .masthead .wrap { gap: .6rem; padding-top: .6rem; padding-bottom: .6rem; }
  .brand { font-size: 1.05rem; }
  nav.primary {
    order: 3; width: 100%; margin-left: 0;
    flex-wrap: nowrap; overflow-x: auto; gap: .2rem;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-bottom: 2px;
  }
  nav.primary::-webkit-scrollbar { display: none; }
  nav.primary a { white-space: nowrap; }
  .whoami { margin-left: auto; padding-left: 0; border-left: none; }
  main { padding-top: 1.4rem; }
  .section-head { margin-top: 1.9rem; }
}

/* ------------------------------------------------------------------
   The hero: our own photographs, edge to edge, before anything else.
------------------------------------------------------------------- */
main.flush { padding-top: 0; }

.hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: clamp(300px, 54vh, 560px);
  background: var(--ink);
  overflow: hidden;
  margin-bottom: 2.2rem;
}

.hero img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.1s ease;
}
.hero img.showing { opacity: 1; }

.hero .shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(10, 16, 22, .78) 0%,
    rgba(10, 16, 22, .30) 38%,
    rgba(10, 16, 22, 0) 68%);
}

.hero .inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 1080px; margin: 0 auto; padding: 0 1.25rem 1.4rem;
  display: flex; align-items: flex-end; gap: 1rem;
}

.hero .plate { color: #fff; flex: 1; min-width: 0; }
.hero .plate .who {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--utility); font-size: .74rem;
  letter-spacing: .12em; text-transform: uppercase;
  opacity: .88; margin-bottom: .35rem;
}
.hero .plate .caption {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.3rem, 3.2vw, 2.1rem);
  letter-spacing: -.02em; line-height: 1.15;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .35);
  margin: 0;
}

.hero .controls { display: flex; gap: .4rem; align-items: center; flex: none; padding-bottom: .3rem; }

.hero .step {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .45);
  color: #fff; font-size: 1rem; line-height: 1; cursor: pointer;
  backdrop-filter: blur(6px);
}
.hero .step:hover { background: rgba(255, 255, 255, .28); }

.hero .ticks { display: flex; gap: 6px; margin-right: .3rem; }
.hero .ticks i {
  width: 7px; height: 7px; border-radius: 50%; display: block;
  background: rgba(255, 255, 255, .4); transition: background .3s, transform .3s;
}
.hero .ticks i.on { background: #fff; transform: scale(1.35); }

.hero.blank {
  display: grid; place-items: center; text-align: center;
  background: linear-gradient(118deg, #E23E57, #6A4C93 46%, #1E8FA8);
}
.hero.blank .msg { color: #fff; padding: 1.5rem; max-width: 30rem; }
.hero.blank .msg h2 { font-size: clamp(1.4rem, 4vw, 2.2rem); }
.hero.blank .msg p { opacity: .9; margin: .3rem 0 1.1rem; }

.countdown.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

@media (max-width: 760px) {
  .hero { height: clamp(260px, 42vh, 380px); margin-bottom: 1.6rem; }
  .hero .inner { padding-bottom: 1rem; flex-direction: column; align-items: flex-start; gap: .7rem; }
  .hero .controls { align-self: flex-end; }
}

/* ------------------------------------------------- choosing the crop point */
.framing { margin-top: .6rem; }
.framing summary { font-size: .84rem; cursor: pointer; color: var(--ink-soft); }
.framing[open] summary { color: var(--ink); font-weight: 600; }

.framing .pick {
  position: relative; cursor: crosshair; line-height: 0;
  border-radius: 6px; overflow: hidden; background: #E7E9E4;
}
.framing .pick img { width: 100%; height: auto; display: block; }

.framing .crosshair {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(22,32,43,.55), inset 0 0 0 2px rgba(22,32,43,.55);
  pointer-events: none;
}

.framing .band {
  aspect-ratio: 21 / 9; overflow: hidden; border-radius: 6px; background: #E7E9E4;
}
.framing .band img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Give the framing picker room when it's open */
.wall .snap:has(.framing[open]) {
  grid-column: 1 / -1; transform: none;
}
.wall .snap:has(.framing[open]) > img { max-width: 320px; }
.framing[open] { max-width: 520px; }
