/* Smell Me Through the Phone: Maison Monie, a deadpan perfume house. */

:root {
  --green: oklch(31% 0.055 165);
  --green-deep: oklch(25% 0.05 165);
  --gold: oklch(79% 0.1 85);
  --gold-bright: oklch(88% 0.09 90);
  --gold-deep: oklch(63% 0.11 75);
  --ivory: oklch(94% 0.025 90);
  --black: oklch(17% 0.01 165);
  --rule: color-mix(in oklch, var(--gold) 55%, transparent);

  --display: 'Libre Baskerville', Georgia, serif;
  --body: 'Hanken Grotesk', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --foil: linear-gradient(100deg, var(--gold-deep), var(--gold-bright) 45%, var(--gold) 70%, var(--gold-deep));
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--gold-deep) var(--green-deep); }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--green);
  color: var(--gold);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: clip;
  caret-color: var(--gold);
}

::selection { background: var(--gold); color: var(--green-deep); }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 4px; }
.btn:has(+ .sr-only:focus-visible) { outline: 2px solid var(--gold-bright); outline-offset: 4px; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- top bar / footer ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-wrap: balance;
  line-height: 1.5;
}
.music {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.9rem 0.3rem 0.7rem;
  white-space: nowrap;
  background: none;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font: 500 0.875rem var(--body);
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s;
}
.music svg { width: 1rem; height: 1rem; fill: currentColor; }
.music .i-pause, .music[aria-pressed='true'] .i-play { display: none; }
.music[aria-pressed='true'] .i-pause { display: inline; }
.music:hover, .music[aria-pressed='true'] { background: var(--gold); color: var(--green-deep); }

main { flex: 1; display: grid; }

.foot {
  padding: 1.25rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom));
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.8rem 1.25rem;
  border: 1px solid var(--gold);
  border-radius: 3px;
  font: 600 1.05rem/1.15 var(--body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), filter 0.3s, background-color 0.3s, color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { flex: none; width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.btn-gold { background: var(--foil); border-color: var(--gold-bright); color: var(--black); box-shadow: 0 0.6rem 1.4rem -0.8rem oklch(10% 0.03 165 / 0.9); }
.btn-line { background: none; color: var(--gold); }
.btn-gold:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-line:hover { background: var(--gold); color: var(--green-deep); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.6; cursor: default; }

.textbtn {
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  background: none;
  border: 0;
  color: var(--gold);
  font: 400 0.95rem var(--body);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  cursor: pointer;
}

/* ---------- the counter (idle + sniffing) ---------- */

.counter {
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vh, 3rem) var(--gutter) 1rem;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(1.25rem, 3.5vh, 2rem);
  text-align: center;
}

.bottle {
  width: clamp(5.5rem, 15svh, 8.5rem);
  overflow: visible;
  filter: drop-shadow(0 1rem 1rem oklch(12% 0.04 165 / 0.6));
}
.bottle-label { font-family: var(--display); font-size: 8px; letter-spacing: 0.04em; fill: #1c2a22; }

.counter h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 8.6vw, 3rem);
  line-height: 1.15;
  color: var(--gold-bright);
  text-wrap: balance;
}
.error { display: none; color: var(--ivory); font-size: 1.05rem; text-wrap: balance; }
body[data-state='error'] .error { display: block; }

.loading { display: none; width: 100%; justify-items: center; gap: 1.25rem; }
.preview {
  position: relative;
  width: min(62%, 15rem);
  aspect-ratio: 1;
  padding: 0.4rem;
  border: 1px solid var(--gold);
  overflow: hidden;
}
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--rule);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: turn 0.9s linear infinite;
}
.preview:has(img)::before {
  inset: 0 0 auto;
  margin: 0;
  width: 100%;
  height: 28%;
  border: 0;
  border-radius: 0;
  background: linear-gradient(to bottom, transparent, color-mix(in oklch, var(--gold-bright) 55%, transparent));
  border-bottom: 2px solid var(--gold-bright);
  animation: scan 1.8s ease-in-out infinite alternate;
}
.status { font-size: 1.15rem; font-weight: 500; color: var(--ivory); min-height: 1.5em; }
.bar { width: 100%; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold-bright); transform: scaleX(0); transform-origin: left; transition: transform 0.4s linear; }
@keyframes turn { to { rotate: 360deg; } }
@keyframes scan { from { translate: 0 -100%; } to { translate: 0 360%; } }

.choose { width: 100%; display: grid; gap: 0.9rem; }

/* Without a touch camera, one button is enough. */
@media (hover: hover) and (pointer: fine) {
  .camera-only { display: none; }
  .choose .btn-line { background: var(--foil); border-color: var(--gold-bright); color: var(--black); }
  .choose .btn-line:hover { filter: brightness(1.08); }
}

body[data-state='sniffing'] .counter h1,
body[data-state='sniffing'] .choose { display: none; }
body[data-state='sniffing'] .bottle { display: none; }
body[data-state='sniffing'] .loading { display: grid; }

@media (min-width: 60rem) {
  .counter { max-width: 34rem; }
  .counter h1 { font-size: 3.2rem; }
}

/* ---------- result ---------- */

.result {
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding: 1.75rem var(--gutter) 1rem;
  display: grid;
  gap: 1.75rem;
  align-content: start;
}
.reveal { display: grid; justify-items: center; }

.photo {
  width: min(58%, 15rem);
  padding: 0.4rem;
  border: 1px solid var(--gold);
  margin-bottom: 1.5rem;
}
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

.label-card {
  position: relative;
  width: 100%;
  min-height: 11rem;
  display: grid;
  align-content: center;
  background: var(--ivory);
  box-shadow: 0 1.2rem 2rem -1.2rem oklch(10% 0.03 165 / 0.9);
}
.label-card::after {
  content: '';
  position: absolute;
  inset: 0.5rem;
  border: 1px solid var(--gold-deep);
  pointer-events: none;
}
.label-card h2 {
  padding: 2.5rem 1.75rem 0.9rem;
  color: var(--black);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.35rem, 5.8vw, 1.9rem);
  line-height: 1.25;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.rare {
  position: absolute;
  z-index: 2;
  top: -0.8rem;
  left: 50%;
  translate: -50% 0;
  padding: 0.25rem 0.9rem;
  background: var(--foil);
  color: var(--black);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.report { display: grid; gap: 1.5rem; }

.notes { border-top: 1px solid var(--rule); }
.tier {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
}
.tier dt {
  font: 600 0.72rem/1.9 var(--body);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}
.tier dd { font-size: 1.1rem; line-height: 1.4; color: var(--ivory); }

.desc { padding: 0 1.75rem 2.25rem; font-size: 1.05rem; line-height: 1.45; color: oklch(32% 0.03 165); text-align: center; text-wrap: balance; }

.dots { display: flex; gap: 0.6rem; padding-left: 0.2rem; }
.dots i { width: 0.85rem; height: 0.85rem; border: 1px solid var(--gold); rotate: 45deg; }
.dots i.on { background: var(--gold); }
.meter-label { margin-top: 0.7rem; color: var(--ivory); }


.actions { display: grid; gap: 0.9rem; }

/* the one authored moment: the notes settle after the scratch */
.report.is-landing .tier,
.report.is-landing .meter,
.report.is-landing .actions {
  animation: settle 0.9s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 110ms);
}
@keyframes settle { from { opacity: 0; translate: 0 1rem; filter: blur(5px); } }

@media (min-width: 60rem) {
  .result { padding-top: 3rem; }
  .actions { grid-template-columns: 1fr 1fr; }
}

/* ---------- admin ---------- */

.admin { width: 100%; max-width: 36rem; margin-inline: auto; padding: 2rem var(--gutter); display: grid; gap: 2rem; align-content: start; }
.admin h1 { font: 400 clamp(1.8rem, 7vw, 2.4rem)/1.2 var(--display); color: var(--gold-bright); }
.admin h2 { font: 600 0.75rem var(--body); letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 0.9rem; }
.admin form { display: grid; gap: 1.1rem; }
.admin label { display: grid; gap: 0.4rem; font-weight: 500; color: var(--ivory); }
.admin input[type='text'], .admin input[type='password'], .admin input[type='file'] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--ivory);
  border: 1px solid var(--gold);
  border-radius: 3px;
  color: var(--black);
  font: 400 1rem var(--body);
}
.admin input::placeholder { color: oklch(45% 0.03 165); }
.admin .hint { font-size: 0.9rem; color: var(--gold); }
.egg-list { display: grid; }
.egg-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--rule); color: var(--ivory);
}
.egg-list .who { font-weight: 600; color: var(--gold-bright); }
.egg-list button { flex: none; padding: 0.4rem 0.9rem; background: none; border: 1px solid var(--gold); border-radius: 999px; color: var(--gold); font: 500 0.85rem var(--body); cursor: pointer; }
.soon-state { margin-bottom: 0.9rem; color: var(--ivory); }
.admin .msg { min-height: 1.5em; color: var(--gold-bright); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
