/* =========================================================
   Uncle Bazza's Pomodoro — styles
   Mobile first. Warm coastal palette; accent shifts per mode
   via body[data-mode]. No external fonts or assets.
   ========================================================= */

:root {
  /* Base palette */
  --sand: #fbf3e6;
  --sand-2: #f4e4cc;
  --ink: #2a2118;
  --ink-soft: #5e4f40;
  --card: #fffaf2;
  --line: #e6d4b8;

  /* Mode accents (overridden below). --accent is used for text/buttons
     and keeps >= 4.5:1 contrast with white. */
  --accent: #b84f17;          /* sunset orange (dark enough for white text) */
  --accent-bright: #e8772e;   /* decorative ring colour */
  --accent-soft: #fde2cc;
  --bg-top: #fde7cf;
  --bg-bottom: #fbf3e6;

  --radius: 18px;
  --shadow: 0 10px 30px rgba(90, 55, 20, .12), 0 2px 6px rgba(90, 55, 20, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --transition: 600ms ease;
}

/* Short break: eucalyptus green */
body[data-mode="short"] {
  --accent: #2f6e4f;
  --accent-bright: #5fa37f;
  --accent-soft: #d8eee0;
  --bg-top: #dff0e4;
  --bg-bottom: #f3f8ef;
}

/* Long break: ocean blue */
body[data-mode="long"] {
  --accent: #1c5f94;
  --accent-bright: #3b8fd0;
  --accent-soft: #d6e8f6;
  --bg-top: #d5e9f7;
  --bg-bottom: #eef6fb;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.5;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 420px, var(--sand) 100%);
  background-color: var(--sand);
  transition: background var(--transition);
}

/* --------- Utilities --------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--ink); color: #fff;
  padding: 8px 12px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8em;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 .35em;
}

/* --------- Header --------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  max-width: 1080px; margin: 0 auto;
}
.site-header .btn { white-space: nowrap; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { font-size: 1.8rem; line-height: 1; }
.brand__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem; line-height: 1.2;
  color: var(--accent);
  transition: color var(--transition);
}
.brand__tag { margin: 0; font-size: .8rem; color: var(--ink-soft); }

/* --------- Buttons --------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  transition: background-color .2s, color .2s, transform .1s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--secondary {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn--secondary:hover { filter: brightness(.97); }
.btn--ghost {
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn--ghost:hover { background: #fff; }
.btn--big { min-width: 150px; font-size: 1.2rem; padding: 14px 28px; letter-spacing: .02em; }
.btn--small { padding: 6px 14px; font-size: .9rem; min-height: 38px; }
.btn--icon {
  width: 52px; height: 52px; padding: 0;
  display: inline-grid; place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
}
.btn--icon svg { width: 22px; height: 22px; fill: var(--ink-soft); }
.btn--icon:hover svg { fill: var(--accent); }

/* --------- Ad slots ---------
   Reserved sizes so nothing jumps when ads load (no CLS). */
.ad-slot {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  border: 2px dashed rgba(94, 79, 64, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .35);
  overflow: hidden;
}
.ad-slot__label {
  position: absolute; top: 4px; left: 8px;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(94, 79, 64, .7);
  pointer-events: none;
}
.ad-slot--leaderboard {
  width: calc(100% - 32px); max-width: 728px;
  height: 66px;               /* 320x50 + label room on mobile */
  margin-bottom: 8px;
}
.ad-slot--rect {
  width: 300px; max-width: 100%;
  height: 250px;
  margin-top: 16px;
}
.ad-slot--bottom {
  width: calc(100% - 32px); max-width: 970px;
  height: 100px;
  margin: 24px auto;
}

/* --------- Layout --------- */
.layout {
  display: grid;
  gap: 16px;
  padding: 8px 16px 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
}

/* --------- Timer card --------- */
.timer-card { text-align: center; }

.mode-tabs {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--sand-2);
  border-radius: 999px;
  max-width: 100%;
}
.mode-tab {
  font: inherit; font-size: .9rem; font-weight: 600;
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  min-height: 40px;
  transition: background-color .2s, color .2s;
}
.mode-tab[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.ring-wrap {
  position: relative;
  width: min(78vw, 300px);
  aspect-ratio: 1;
  margin: 20px auto 12px;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 12;
  transition: stroke var(--transition);
}
.ring__progress {
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke var(--transition), stroke-dashoffset .35s linear;
}
.ring__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.time {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 16vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--ink);
}
.time-label {
  margin-top: 6px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
}
.set-dots { display: flex; gap: 6px; margin-top: 10px; min-height: 10px; }
.set-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.set-dots span.on { background: var(--accent-bright); }

.controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.kbd-hint { font-size: .8rem; color: var(--ink-soft); margin: 10px 0 0; }

.task { display: block; margin: 18px auto 0; max-width: 420px; text-align: left; }
.task__label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.task input {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.task input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 18px auto 0; max-width: 420px;
}
.stat {
  background: var(--sand);
  border-radius: 12px;
  padding: 10px 6px;
}
.stat dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.stat dd { margin: 2px 0 0; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }

/* --------- Bazza card --------- */
.side { display: flex; flex-direction: column; align-items: center; }
.bazza-card { width: 100%; }
/* Mobile: compact row (avatar left, bubble right) so Bazza stays short. */
.bazza {
  display: flex; flex-direction: row; align-items: flex-start; gap: 14px;
}
.avatar {
  width: 88px; height: 88px; flex: none;
  filter: drop-shadow(0 6px 10px rgba(90, 55, 20, .2));
}
.avatar__bg { fill: var(--accent-soft); transition: fill var(--transition); }
.avatar__head { transform-origin: 100px 140px; transform-box: view-box; }
.avatar__eyes { transform-origin: 100px 98px; transform-box: view-box; animation: blink 5s infinite; }
.avatar.is-nodding .avatar__head { animation: nod .9s ease-in-out; }

.bubble {
  position: relative;
  width: 100%;
  background: #fff;
  border: 2px solid var(--accent-soft);
  border-radius: 16px;
  padding: 12px 16px 14px;
  min-height: 108px;                 /* reserve space so lines don't shift the layout */
  transition: border-color var(--transition);
}
.bubble::before {                    /* pointer left toward the avatar */
  content: "";
  position: absolute; left: -11px; top: 26px;
  width: 18px; height: 18px;
  background: #fff;
  border-left: 2px solid var(--accent-soft);
  border-top: 2px solid var(--accent-soft);
  transform: rotate(-45deg);
}
.bubble__name {
  margin: 0 0 2px;
  font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.bubble__text {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.45;
}
.bubble.is-popping { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }

.bazza-actions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 14px;
}

/* --------- Embed link (only visible in embed mode) --------- */
.embed-link { display: none; }

/* --------- Info / FAQ --------- */
.info { padding: 8px 16px; }
.info__inner {
  max-width: 760px; margin: 16px auto 0;
  background: rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  padding: 20px 18px;
}
.info h2 { font-family: var(--font-display); color: var(--accent); font-size: 1.35rem; margin: 8px 0 8px; }
.info h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.info p, .info li { color: var(--ink); }
.info details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.info summary { cursor: pointer; font-weight: 600; }
.info summary:hover { color: var(--accent); }
.info details p { margin: 8px 0 0; }

.site-footer {
  text-align: center;
  font-size: .82rem;
  color: var(--ink-soft);
  padding: 8px 16px 32px;
}

/* --------- Settings dialog --------- */
.settings {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 0; border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.settings::backdrop { background: rgba(42, 33, 24, .45); }
.settings__form { padding: 16px 18px 18px; }
.settings__head { display: flex; justify-content: space-between; align-items: center; }
.settings__head h2 { margin: 0; font-family: var(--font-display); color: var(--accent); }
.settings fieldset {
  border: 1px solid var(--line); border-radius: 12px;
  margin: 14px 0 0; padding: 10px 12px 12px;
}
.settings legend { font-weight: 700; padding: 0 6px; font-size: .9rem; }
.settings label { display: block; font-size: .9rem; }
.settings input[type="number"], .settings select, .settings textarea {
  display: block; width: 100%;
  margin-top: 4px;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
}
.settings textarea { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; resize: vertical; }
.grid-3, .grid-2 { display: grid; gap: 10px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1fr; margin-top: 10px; }
.toggle { display: flex !important; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.hint { font-size: .8rem; color: var(--ink-soft); margin: 4px 0 0; min-height: 1em; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.settings__foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* --------- Toast --------- */
.toast {
  position: fixed; left: 50%; bottom: 20px;
  transform: translate(-50%, 20px);
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  font-size: .9rem;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --------- Animations --------- */
@keyframes pop {
  0%   { transform: scale(.92); opacity: .3; }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes nod {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  30%      { transform: rotate(-4deg) translateY(3px); }
  60%      { transform: rotate(3deg) translateY(1px); }
}
@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  97%           { transform: scaleY(.1); }
}

/* =========================================================
   Wider screens
   ========================================================= */
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .card { padding: 24px; }
}

@media (min-width: 768px) {
  .ad-slot--leaderboard { height: 94px; }   /* 728x90 + border */
  .brand__title { font-size: 1.4rem; }

  .avatar { width: 130px; height: 130px; }
  .bubble { margin-top: 10px; }
  .bubble::before { top: 34px; }
}

@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .bazza { flex-direction: column; align-items: center; }
  .avatar { width: 140px; height: 140px; }
  .bubble { margin-top: 0; }
  .bubble::before { left: 50%; top: -11px; transform: translateX(-50%) rotate(45deg); }
  .side { position: sticky; top: 16px; }
}

/* =========================================================
   Embed mode: compact, no chrome, no ads
   ========================================================= */
body.embed { background: var(--bg-bottom); min-height: 0; }
body.embed .chrome,
body.embed .chrome-soft,
body.embed .ad-slot,
body.embed .skip-link { display: none !important; }
body.embed .layout { grid-template-columns: 1fr; padding: 8px; gap: 8px; max-width: 520px; }
body.embed .card { box-shadow: none; border: 1px solid var(--line); padding: 14px 12px; }
body.embed .ring-wrap { width: min(56vw, 180px); margin: 10px auto 6px; }
body.embed .mode-tab { font-size: .82rem; padding: 6px 10px; min-height: 34px; }
body.embed .btn--big { min-width: 120px; padding: 10px 22px; font-size: 1.05rem; }
body.embed .btn--icon { width: 44px; height: 44px; }
body.embed .time { font-size: clamp(2.4rem, 12vw, 3.2rem); }
body.embed .stats { display: none; }
body.embed .task { margin-top: 12px; }
body.embed .bazza { flex-direction: row; align-items: center; }
body.embed .bubble::before { left: -11px; top: 26px; transform: rotate(-45deg); }
body.embed .avatar { width: 72px; height: 72px; }
body.embed .bubble { min-height: 72px; padding: 8px 12px; margin-top: 0; }
body.embed .bubble__text { font-size: .95rem; }
body.embed .bazza-actions { margin-top: 8px; }
body.embed .side { position: static; }
body.embed .embed-link {
  display: block;
  text-align: center;
  font-size: .8rem;
  color: var(--accent);
  padding: 4px 0 10px;
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .avatar__eyes { animation: none; }
}
