/* Matcha — a second design variant of the timer (see /matcha/).
   Full-bleed photo background, high-contrast serif numerals, cream on green.
   Deliberately independent of style.css so the original design stays untouched. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #FBE3A2;              /* the butter-yellow of the type */
  --cream-soft: rgba(251, 227, 162, 0.66);
  --cream-faint: rgba(251, 227, 162, 0.28);
  --ink: #2C3A1C;                /* dark matcha, used as button foreground */
  --green: #7E9163;              /* solid fallback / page background below the fold */
  --green-deep: #3A472A;
  --glass: rgba(44, 58, 28, 0.34);
  --serif: "Playfair Display", "Didot", "Bodoni MT", "Big Caslon", Garamond, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html, body { min-height: 100%; }

body {
  font-family: var(--sans);
  background: var(--green-deep);
  color: var(--cream);
}

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

/* ---------- Hero: the photo fills the viewport, timer centered on it ---------- */

.mv-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 5vw;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;

  /* The gradient doubles as the fallback if the photo is missing */
  background-color: var(--green);
  background-image:
    linear-gradient(rgba(58, 71, 42, 0.20), rgba(58, 71, 42, 0.34)),
    radial-gradient(120% 90% at 30% 20%, #B7C79A 0%, #8FA173 45%, #6E815A 100%);
  background-size: cover;
  background-position: center;
}

/* Layered separately so a failed image request still leaves the gradient */
.mv-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  /* The wash keeps cream type legible over the brightest parts of the photo */
  background:
    linear-gradient(rgba(52, 65, 37, 0.30), rgba(44, 58, 28, 0.44)),
    url("/matcha.jpeg") center / cover no-repeat;
}

.mv-hero > * { position: relative; }
.mv-hero[hidden] { display: none; }

/* Stand-in shown while the timer lives in the pop-out window */
.mv-stage {
  flex-direction: column;
  gap: 14px;
  color: var(--cream);
  font-size: 14px;
}

/* ---------- Full layout ---------- */

.mv-card {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4vh, 46px);
  text-align: center;
}

/* Mode pills */
.mv-modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 18px);
}

.mv-mode {
  font-size: clamp(0.82rem, 1.45vw, 1.32rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--cream-soft);
  padding: 0.52em 1.35em;
  border: 1.5px solid var(--cream-faint);
  border-radius: 999px;
  backdrop-filter: blur(2px);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.mv-mode:hover { color: var(--cream); border-color: var(--cream-soft); }
.mv-mode.active {
  color: var(--cream);
  border-color: var(--cream);
  background: rgba(251, 227, 162, 0.12);
}

/* The clock */
.mv-time {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(4.5rem, 17vw, 15rem);
  line-height: 0.92;
  letter-spacing: -0.015em;
  color: var(--cream);
  font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 2px 30px rgba(44, 58, 28, 0.25);
}

/* Controls */
.mv-controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 20px);
}

.mv-start {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.7rem);
  min-width: 4.6em;
  padding: 0.42em 1.35em;
  border: 1.5px solid var(--cream-soft);
  border-radius: 999px;
  color: var(--cream);
  transition: background 0.18s, border-color 0.18s;
}
.mv-start:hover { background: rgba(251, 227, 162, 0.14); border-color: var(--cream); }
.mv-start:active { background: rgba(251, 227, 162, 0.24); }

.mv-icon {
  width: clamp(38px, 3.6vw, 54px);
  height: clamp(38px, 3.6vw, 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--cream-soft);
  border-radius: 50%;
  color: var(--cream);
  transition: background 0.18s, border-color 0.18s;
}
.mv-icon:hover { background: rgba(251, 227, 162, 0.14); border-color: var(--cream); }
.mv-icon:active { background: rgba(251, 227, 162, 0.24); }
.mv-icon svg { width: 46%; height: 46%; }

/* Settings popover */
.mv-settings {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 232px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(38, 50, 25, 0.72);
  border: 1px solid var(--cream-faint);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(26, 34, 17, 0.35);
  text-align: left;
  z-index: 10;
}
.mv-settings[hidden] { display: none; }

.mv-settings-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--cream-soft);
  margin-bottom: 12px;
}

.mv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mv-row + .mv-row { margin-top: 12px; }
.mv-row-label { font-size: 13px; color: var(--cream); }

.mv-steppers { display: flex; gap: 6px; flex: none; }
.mv-step {
  min-width: 34px;
  padding: 5px 0;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--cream-faint);
  border-radius: 999px;
  color: var(--cream);
}
.mv-step:hover { background: rgba(251, 227, 162, 0.14); }

.mv-toggle {
  width: 42px;
  height: 23px;
  flex: none;
  border-radius: 999px;
  background: rgba(251, 227, 162, 0.22);
  position: relative;
  transition: background 0.16s;
}
.mv-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--cream);
  transition: left 0.16s, background 0.16s;
}
.mv-toggle[aria-checked="true"] { background: var(--cream); }
.mv-toggle[aria-checked="true"] .mv-toggle-thumb { left: 22px; background: var(--ink); }

/* Progress: a hairline that fills across the bottom of the hero */
.mv-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(251, 227, 162, 0.18);
}
.mv-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cream);
}

/* End-of-session pulse */
.mv-flash {
  position: absolute;
  inset: 0;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
}
.flashing .mv-flash { animation: mv-pulse 1.3s ease-in-out infinite; }
@keyframes mv-pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.20; }
}

/* ---------- Mini pill (pop-out window at small sizes) ---------- */

.mv-mini {
  position: relative;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 18px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.mv-mini-time {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  color: var(--cream);
  font-variant-numeric: tabular-nums lining-nums;
  flex: 1;
  text-align: left;
}

.mv-mini-btn {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--cream-soft);
  border-radius: 50%;
  color: var(--cream);
}
.mv-mini-btn:hover { background: rgba(251, 227, 162, 0.14); }

/* ---------- Pop-out (Document Picture-in-Picture) window ---------- */

body.pip {
  height: 100vh;
  display: flex;
  -webkit-user-select: none;
  user-select: none;
  background-color: var(--green);
  background-image:
    linear-gradient(rgba(52, 65, 37, 0.32), rgba(44, 58, 28, 0.46)),
    url("/matcha.jpeg");
  background-size: cover;
  background-position: center;
}
body.pip .mv-hero {
  flex: 1;
  min-height: 0;
  padding: 10px 12px;
  background: none;
}
body.pip .mv-hero::before { display: none; }
body.pip .mv-card { gap: 14px; }
body.pip .mv-time { font-size: clamp(3rem, 20vw, 6rem); }

/* Inside the pop-out the layout is chosen by window size: pill when small,
   the full stack once it is resized big enough. The page itself always
   shows the full layout. */
body.pip .mv-card { display: none; }
body.pip .mv-mini { display: flex; }
@media (min-width: 360px) and (min-height: 420px) {
  body.pip .mv-card { display: flex; }
  body.pip .mv-mini { display: none; }
}

/* Size toggles only make sense inside the pop-out window... */
.pip-only { display: none; }
body.pip .pip-only { display: flex; }
/* ...and the pop-out buttons don't — closing the window pops it back in */
body.pip #mvPipBtn, body.pip #mvMiniPipBtn { display: none; }

body.pip .mv-content { display: none; }

/* ---------- Article below the fold ---------- */

.mv-content {
  max-width: 660px;
  margin: 0 auto;
  padding: 64px 24px 72px;
  color: rgba(251, 227, 162, 0.78);
  font-size: 15px;
  line-height: 1.75;
}

.mv-content h1, .mv-content h2, .mv-content h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--cream);
}
.mv-content h1 { font-size: 30px; line-height: 1.25; margin-bottom: 16px; }
.mv-content h2 { font-size: 22px; margin: 38px 0 10px; }
.mv-content h3 { font-size: 17px; margin: 24px 0 6px; }

.mv-content p { margin-bottom: 12px; }
.mv-content ul, .mv-content ol { margin: 0 0 12px; padding-left: 22px; }
.mv-content li { margin-bottom: 6px; }
.mv-content strong, .mv-content em { color: var(--cream); font-style: normal; }
.mv-content a { color: var(--cream); text-underline-offset: 3px; }

.mv-more { margin-top: 40px; }
.mv-links {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 16px;
}

.mv-content footer {
  margin-top: 46px;
  padding-top: 18px;
  border-top: 1px solid rgba(251, 227, 162, 0.18);
  font-size: 13px;
  color: var(--cream-soft);
}

@media (max-width: 520px) {
  .mv-modes { gap: 8px; }
  .mv-mode { padding: 0.5em 1em; }
}
