/* Fokusin - style.css
   Design notes:
   - No circular progress ring. Progress = the page itself filling from the bottom.
   - One accent color per mode, everything else is off-black / paper.
   - Type does the heavy lifting: Bricolage Grotesque, optical sizing on.
*/

:root{
  --ink:#F4F3F1;
  --ink-2:#A8A5A0;
  --ink-3:#6B6862;
  --bg:#0B0B0C;
  --surface:#141416;
  --surface-2:#1D1D20;
  --line:rgba(255,255,255,.09);
  --line-2:rgba(255,255,255,.16);

  --accent:#FF5F3D;
  --accent-ink:#0B0B0C;
  --fill:rgba(255,95,61,.13);

  --r-sm:10px;
  --r-md:16px;
  --r-lg:26px;
  --sheet-r:28px;

  --pad:clamp(18px, 5vw, 32px);
  --safe-t:env(safe-area-inset-top, 0px);
  --safe-b:env(safe-area-inset-bottom, 0px);

  --ease:cubic-bezier(.22,1,.36,1);
  --snap:cubic-bezier(.34,1.56,.64,1);
}

/* mode accents */
[data-mode="focus"]{ --accent:#FF5F3D; --fill:rgba(255,95,61,.13); }
[data-mode="short"]{ --accent:#3DDC97; --fill:rgba(61,220,151,.12); }
[data-mode="long"] { --accent:#5B8CFF; --fill:rgba(91,140,255,.13); }

[data-theme="light"]{
  --ink:#101013;
  --ink-2:#5C5A56;
  --ink-3:#8E8B85;
  --bg:#F5F3EF;
  --surface:#FFFFFF;
  --surface-2:#EEEBE5;
  --line:rgba(0,0,0,.10);
  --line-2:rgba(0,0,0,.18);
  --accent-ink:#FFFFFF;
}
[data-theme="light"][data-mode="focus"]{ --accent:#E8431F; --fill:rgba(232,67,31,.10); }
[data-theme="light"][data-mode="short"]{ --accent:#0E9F6B; --fill:rgba(14,159,107,.10); }
[data-theme="light"][data-mode="long"] { --accent:#2F5FE0; --fill:rgba(47,95,224,.10); }

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

html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:"Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overscroll-behavior:none;
  -webkit-tap-highlight-color:transparent;
  transition:background .5s var(--ease), color .5s var(--ease);
}

button,input{ font:inherit; color:inherit; }
button{ background:none; border:0; cursor:pointer; padding:0; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

:where(button,input,[role="switch"]):focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px;
  border-radius:8px;
}

/* ---------- progress fill ---------- */
.fill{
  position:fixed; inset:auto 0 0 0;
  height:0%;
  background:linear-gradient(to top, var(--fill), transparent);
  pointer-events:none;
  z-index:0;
  transition:height .95s linear, background .5s var(--ease);
}
.hairline{
  position:fixed; left:0; right:0; bottom:0;
  height:1px;
  background:var(--accent);
  opacity:.5;
  transform:translateY(0);
  pointer-events:none;
  z-index:0;
  transition:bottom .95s linear, opacity .4s var(--ease);
}
body[data-running="0"] .hairline{ opacity:0; }

/* ---------- layout ---------- */
.app{
  position:relative;
  z-index:1;
  min-height:100svh;
  max-width:520px;
  margin-inline:auto;
  padding:calc(var(--safe-t) + 14px) var(--pad) calc(var(--safe-b) + 14px);
  display:grid;
  grid-template-rows:auto auto 1fr auto auto;
  gap:clamp(14px, 3vh, 26px);
}

/* ---------- top bar ---------- */
.bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; }

.brand{ display:flex; align-items:baseline; gap:3px; }
.brand__word{
  font-size:17px; font-weight:700; letter-spacing:-.03em;
  font-variation-settings:"wdth" 88;
}
.brand__dot{
  width:6px; height:6px; border-radius:50%;
  background:var(--accent);
  transition:background .5s var(--ease);
}
body[data-running="1"] .brand__dot{ animation:pulse 2.4s ease-in-out infinite; }
@keyframes pulse{ 0%,100%{opacity:1; transform:scale(1)} 50%{opacity:.35; transform:scale(.8)} }

.bar__right{ display:flex; align-items:center; gap:6px; }

.iconbtn{
  width:38px; height:38px;
  display:grid; place-items:center;
  border-radius:12px;
  color:var(--ink-2);
  transition:background .2s, color .2s, transform .15s var(--snap);
}
.iconbtn svg{ width:19px; height:19px; fill:currentColor; }
.iconbtn:hover{ background:var(--surface); color:var(--ink); }
.iconbtn:active{ transform:scale(.9); }

.chip{
  display:inline-flex; align-items:center; gap:5px;
  height:32px; padding:0 11px;
  border-radius:999px;
  background:var(--surface);
  border:1px solid var(--line);
  font-size:13px; font-weight:600;
  font-variant-numeric:tabular-nums;
  transition:transform .15s var(--snap), border-color .2s;
}
.chip svg{ width:14px; height:14px; fill:var(--accent); transition:fill .5s var(--ease); }
.chip:active{ transform:scale(.94); }
.chip[data-hot="1"]{ border-color:color-mix(in oklab, var(--accent) 45%, transparent); }

/* ---------- mode switch ---------- */
.modes{
  position:relative;
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:2px; padding:4px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:999px;
}
.modes button{
  position:relative; z-index:1;
  height:36px;
  border-radius:999px;
  font-size:13.5px; font-weight:600; letter-spacing:-.01em;
  color:var(--ink-3);
  white-space:nowrap;
  transition:color .28s var(--ease);
}
.modes button[aria-selected="true"]{ color:var(--accent-ink); }
.modes__pill{
  position:absolute; z-index:0;
  top:4px; bottom:4px; left:4px;
  width:calc((100% - 8px)/3);
  border-radius:999px;
  background:var(--accent);
  transition:transform .42s var(--snap), background .5s var(--ease);
}

/* ---------- stage ---------- */
.stage{
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:clamp(10px, 2.4vh, 20px);
  text-align:center;
  min-height:0;
}

.eyebrow{
  margin:0;
  font-size:13px; font-weight:500;
  color:var(--ink-3);
  letter-spacing:.01em;
  min-height:1.2em;
  transition:opacity .3s var(--ease);
}

.clock{
  display:flex; align-items:baseline; justify-content:center;
  font-size:clamp(76px, 25vw, 132px);
  line-height:.86;
  font-weight:700;
  letter-spacing:-.055em;
  font-variation-settings:"wdth" 82, "opsz" 96;
  font-variant-numeric:tabular-nums;
  user-select:none;
}
.clock__d{
  display:inline-block;
  width:.58em;
  text-align:center;
  transition:transform .34s var(--snap), opacity .34s var(--ease);
}
.clock__d.tick{ animation:tick .36s var(--snap); }
@keyframes tick{
  0%{ transform:translateY(.14em) scale(.94); opacity:.35 }
  100%{ transform:none; opacity:1 }
}
.clock__sep{
  width:.3em; text-align:center;
  opacity:.28;
  transform:translateY(-.04em);
}
body[data-running="1"] .clock__sep{ animation:blink 2s steps(1,end) infinite; }
@keyframes blink{ 0%,50%{opacity:.28} 51%,100%{opacity:.06} }

body[data-paused="1"] .clock{ opacity:.42; }
.clock{ transition:opacity .35s var(--ease); }

.rounds{ display:flex; align-items:center; gap:10px; }
.rounds__dots{ display:flex; gap:5px; }
.rounds__dots i{
  width:6px; height:6px; border-radius:50%;
  background:var(--line-2);
  transition:background .35s var(--ease), transform .35s var(--snap);
}
.rounds__dots i[data-on="1"]{ background:var(--accent); }
.rounds__dots i[data-now="1"]{ transform:scale(1.5); background:var(--accent); }
.rounds__label{ font-size:12.5px; color:var(--ink-3); font-weight:500; }

.task{ width:100%; max-width:340px; }
.task input{
  width:100%;
  height:42px;
  padding:0 14px;
  text-align:center;
  background:transparent;
  border:1px solid transparent;
  border-radius:12px;
  font-size:14.5px; font-weight:500;
  color:var(--ink);
  transition:background .2s, border-color .2s;
}
.task input::placeholder{ color:var(--ink-3); }
.task input:hover{ border-color:var(--line); }
.task input:focus{ background:var(--surface); border-color:var(--line-2); outline:none; }

/* ---------- controls ---------- */
.controls{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:clamp(10px, 4vw, 20px);
}

.primary{
  height:60px;
  min-width:clamp(150px, 44vw, 190px);
  padding:0 34px;
  border-radius:999px;
  background:var(--accent);
  color:var(--accent-ink);
  font-size:17px; font-weight:700; letter-spacing:-.015em;
  box-shadow:0 8px 26px -10px color-mix(in oklab, var(--accent) 70%, transparent);
  transition:transform .16s var(--snap), background .5s var(--ease), box-shadow .3s;
}
.primary:active{ transform:scale(.955); }

.ghost{
  display:flex; flex-direction:column; align-items:center; gap:5px;
  color:var(--ink-3);
  font-size:11.5px; font-weight:600;
  padding:8px 4px;
  border-radius:14px;
  transition:color .2s, transform .15s var(--snap), opacity .25s;
}
.ghost svg{ width:19px; height:19px; fill:currentColor; }
.ghost:nth-of-type(1){ justify-self:end; }
.controls .ghost:last-child{ justify-self:start; }
.ghost:hover{ color:var(--ink); }
.ghost:active{ transform:scale(.9); }
.ghost[disabled]{ opacity:.28; pointer-events:none; }

/* ---------- bottom strip ---------- */
.foot{ display:flex; flex-direction:column; gap:11px; }

.strip{
  display:grid; grid-template-columns:repeat(3,1fr);
  border-top:1px solid var(--line);
  padding-top:14px;
}
.strip__item{ display:flex; flex-direction:column; align-items:center; gap:2px; }
.strip__item b{ font-size:16px; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.strip__item small{ font-size:11px; color:var(--ink-3); font-weight:500; }

/* --ink-2, bukan --ink-3: pada 11px teks ini terhitung "normal text" di WCAG,
   jadi butuh >= 4.5:1. --ink-3 cuma 3.07:1 di tema terang, gagal. */
.credit{
  margin:0;
  display:flex; align-items:center; justify-content:center; gap:7px;
  font-size:11px; font-weight:500;
  letter-spacing:.02em;
  color:var(--ink-2);
}
.credit a{
  color:var(--ink-2);
  text-decoration:none;
  font-weight:600;
  transition:color .2s var(--ease);
}
.credit a:hover{ color:var(--accent); }
.credit a:focus-visible{ border-radius:5px; }
.credit__sep{ opacity:.55; }

/* ---------- toast ---------- */
.toast{
  position:fixed;
  left:50%; bottom:calc(var(--safe-b) + 92px);
  transform:translate(-50%, 14px);
  z-index:60;
  max-width:min(90vw, 340px);
  padding:11px 18px;
  border-radius:999px;
  background:var(--surface-2);
  border:1px solid var(--line);
  box-shadow:0 12px 34px -14px rgba(0,0,0,.7);
  font-size:13.5px; font-weight:500;
  text-align:center;
  opacity:0; pointer-events:none;
  transition:opacity .3s var(--ease), transform .34s var(--snap);
}
.toast[data-show="1"]{ opacity:1; transform:translate(-50%,0); }

/* ---------- sheets ---------- */
.scrim{
  position:fixed; inset:0; z-index:70;
  background:rgba(0,0,0,.5);
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
  opacity:0;
  transition:opacity .32s var(--ease);
}
.scrim[data-show="1"]{ opacity:1; }

.sheet{
  position:fixed; z-index:80;
  left:0; right:0; bottom:0;
  max-width:520px; margin-inline:auto;
  max-height:88svh;
  display:flex; flex-direction:column;
  background:var(--bg);
  border:1px solid var(--line);
  border-bottom:0;
  border-radius:var(--sheet-r) var(--sheet-r) 0 0;
  box-shadow:0 -20px 60px -22px rgba(0,0,0,.75);
  transform:translateY(100%);
  transition:transform .42s var(--ease);
}
.sheet[data-show="1"]{ transform:none; }

.sheet__grab{
  width:38px; height:4px; border-radius:99px;
  background:var(--line-2);
  margin:10px auto 0;
  flex:none;
}
.sheet__head{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px var(--pad) 8px;
  flex:none;
}
.sheet__head h2{
  margin:0;
  font-size:20px; font-weight:700; letter-spacing:-.03em;
  font-variation-settings:"wdth" 88;
}
.sheet__body{
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  padding:4px var(--pad) calc(var(--safe-b) + 26px);
  scrollbar-width:thin;
  scrollbar-color:var(--line-2) transparent;
}
.sheet__body::-webkit-scrollbar{ width:6px; }
.sheet__body::-webkit-scrollbar-track{ background:transparent; }
.sheet__body::-webkit-scrollbar-thumb{
  background:var(--line-2);
  border-radius:99px;
}

.label{
  margin:22px 0 8px;
  font-size:11px; font-weight:700;
  letter-spacing:.09em; text-transform:uppercase;
  color:var(--ink-3);
}
.label:first-child{ margin-top:8px; }

.rows{
  border:1px solid var(--line);
  border-radius:var(--r-md);
  overflow:hidden;
  background:var(--surface);
}
.row{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  min-height:52px;
  padding:9px 14px;
  border-bottom:1px solid var(--line);
  font-size:14.5px; font-weight:500;
}
.row:last-child{ border-bottom:0; }

.note{
  margin:9px 2px 0;
  font-size:12px; line-height:1.5;
  color:var(--ink-3);
}

/* stepper */
.stepper{ display:inline-flex; align-items:center; gap:2px; flex:none; }
.stepper button{
  width:32px; height:32px;
  display:grid; place-items:center;
  border-radius:9px;
  background:var(--surface-2);
  color:var(--ink-2);
  font-size:17px; font-weight:600; line-height:1;
  transition:background .18s, color .18s, transform .13s var(--snap);
}
.stepper button:hover{ color:var(--ink); }
.stepper button:active{ transform:scale(.88); }
.stepper b{
  min-width:34px; text-align:center;
  font-size:15px; font-weight:700;
  font-variant-numeric:tabular-nums;
}
.stepper i{ font-style:normal; font-size:11.5px; color:var(--ink-3); width:26px; }

/* switch */
.switch{
  width:47px; height:28px; flex:none;
  border-radius:999px;
  background:var(--surface-2);
  border:1px solid var(--line);
  padding:2px;
  display:flex; align-items:center;
  transition:background .28s var(--ease), border-color .28s;
}
.switch i{
  width:22px; height:22px; border-radius:50%;
  background:var(--ink-3);
  display:block;
  transition:transform .3s var(--snap), background .28s var(--ease);
}
.switch[aria-checked="true"]{ background:var(--accent); border-color:transparent; }
.switch[aria-checked="true"] i{ transform:translateX(19px); background:var(--accent-ink); }

/* segmented */
.segs{
  display:inline-flex; gap:2px; flex:none;
  padding:3px;
  background:var(--surface-2);
  border-radius:11px;
}
.segs button{
  padding:0 11px; height:29px;
  border-radius:8px;
  font-size:12.5px; font-weight:600;
  color:var(--ink-3);
  transition:background .22s var(--ease), color .22s;
}
.segs button[data-on="1"]{ background:var(--accent); color:var(--accent-ink); }

/* range */
.range{
  -webkit-appearance:none; appearance:none;
  width:132px; height:4px; flex:none;
  border-radius:99px;
  background:var(--surface-2);
  outline:none;
}
.range::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:18px; height:18px; border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  box-shadow:0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
.range::-moz-range-thumb{
  width:18px; height:18px; border-radius:50%; border:0;
  background:var(--accent); cursor:pointer;
}

.danger{
  height:32px; padding:0 15px;
  border-radius:9px;
  background:color-mix(in oklab, #FF4D4D 16%, transparent);
  color:#FF6B6B;
  font-size:13px; font-weight:600;
  transition:transform .14s var(--snap);
}
.danger:active{ transform:scale(.94); }

/* stats */
.bigrow{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:8px;
  padding:18px 4px 4px;
}
.bigrow div{ display:flex; flex-direction:column; align-items:center; gap:3px; text-align:center; }
.bigrow b{
  font-size:clamp(20px, 6vw, 25px); font-weight:700;
  letter-spacing:-.03em; font-variant-numeric:tabular-nums;
}
.bigrow small{ font-size:11px; color:var(--ink-3); font-weight:500; }

.chart{
  display:grid; grid-template-columns:repeat(7,1fr);
  gap:8px;
  align-items:end;
  height:126px;
  padding:12px 14px 0;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  background:var(--surface);
}
.chart .bar{
  display:flex; flex-direction:column; align-items:center; gap:6px;
  height:100%;
  justify-content:flex-end;
}
.chart .bar span{
  width:100%;
  border-radius:6px 6px 3px 3px;
  background:var(--accent);
  min-height:3px;
  opacity:.85;
  transition:height .5s var(--ease);
}
.chart .bar[data-empty="1"] span{ background:var(--line-2); opacity:1; }
.chart .bar small{ font-size:10px; color:var(--ink-3); font-weight:600; padding-bottom:10px; }

.hist{
  display:flex; align-items:center; justify-content:space-between;
  min-height:46px; padding:8px 14px;
  border-bottom:1px solid var(--line);
  font-size:13.5px;
}
.hist:last-child{ border-bottom:0; }
.hist b{ font-weight:600; }
.hist span{ color:var(--ink-3); font-size:12.5px; font-variant-numeric:tabular-nums; }
.empty{ padding:22px 14px; text-align:center; color:var(--ink-3); font-size:13px; }

/* ---------- responsive ---------- */
@media (min-width:560px){
  .app{ gap:clamp(18px, 3.4vh, 30px); }
  .clock{ font-size:clamp(110px, 15vw, 150px); }
}

/* Layar tinggi (tablet, desktop): jangan biarkan isinya melar sampai
   jam terapung di tengah ruang kosong. Kunci tingginya, taruh di atas. */
@media (min-height:900px){
  .app{
    min-height:0;
    height:auto;
    max-height:none;
    padding-top:calc(var(--safe-t) + 6vh);
    padding-bottom:calc(var(--safe-b) + 32px);
    grid-template-rows:auto auto auto auto auto;
    gap:clamp(22px, 3.2vh, 38px);
  }
  .stage{ padding:clamp(20px, 4vh, 48px) 0; }
}

@media (max-height:640px){
  .clock{ font-size:clamp(60px, 18vw, 88px); }
  .primary{ height:54px; }
  .task{ display:none; }
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}
