/* Daily — Swiss/Japanese print: warm paper, one ink, one muted pine accent, sharp ink rules.
   Type: Inter Tight only. Sizes: 13 meta / 15 small text / 16 body / 19 item titles / 28 statements.
   Grid: one column on phones (20px gutters); two columns from 960px (day | reading). */

@font-face {
  font-family: 'Inter Tight';
  src: url('assets/fonts/inter-tight-latin.woff2') format('woff2');
  font-weight: 400 650;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f3f0e8;
  --paper-2: #e9e5da;   /* one tone step down: recessed areas */
  --ink: #161513;
  --soft: #57534b;      /* 6.9:1 on paper */
  --hair: #cdc6b6;      /* row lines */
  --empty: #dfd9cc;     /* a day not logged */
  --accent: #2e5a4c;    /* muted pine, 7:1 on paper */
  --accent-pale: #d5e0d9;
  --on-accent: #f6f4ee;
  --danger: #8f2d22;

  --font: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --gutter: 20px;
  --block-gap: 56px;
  --tap: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  font-feature-settings: 'ss01' 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; overflow-x: clip;
}
h1, h2, h3, p, blockquote, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 14px; text-decoration: none;
}
.skip:focus-visible { top: 12px; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* ---- top bar ------------------------------------------------------------------------------ */
.bar { padding-top: env(safe-area-inset-top); }
.bar__in { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.wordmark { font-weight: 650; font-size: 17px; letter-spacing: -0.02em; margin-right: auto; }
/* the mark: a dot resting on a floor line */
.mark { position: relative; width: 18px; height: 18px; }
.mark::before { content: ''; position: absolute; left: 4px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.mark::after { content: ''; position: absolute; left: 0; right: 0; bottom: 3px; height: 2px; background: var(--ink); }

/* ---- page title --------------------------------------------------------------------------- */
.page { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.title-row { padding: 20px 0 28px; border-top: 2px solid var(--ink); }
h1 { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; }
.title-note { margin-top: 6px; color: var(--soft); font-size: 16px; }

/* ---- blocks: every section opens on a sharp ink rule -------------------------------------- */
.block { border-top: 1px solid var(--ink); padding-top: 12px; margin-bottom: var(--block-gap); }
.block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); margin-bottom: 12px; }
h2 { font-size: 16px; line-height: 1.25; font-weight: 600; letter-spacing: -0.005em; }
.head-actions { display: flex; gap: 4px; }
.head-meta { color: var(--soft); font-size: 13px; }

/* ---- controls ----------------------------------------------------------------------------- */
.link {
  min-height: var(--tap); padding: 0 8px; margin-right: -8px;
  font-size: 14px; color: var(--soft);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--hair);
  transition: color .15s, text-decoration-color .15s;
}
.link--danger { color: var(--danger); }
@media (hover: hover) { .link:hover { color: var(--ink); text-decoration-color: currentColor; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--ink); background: transparent;
  font-size: 15px; font-weight: 550; letter-spacing: -0.005em;
  transition: background-color .15s, color .15s, transform .12s var(--ease);
}
.btn:active, .energy button:active, .check:active, .btn-2min:active, .save:active { transform: translateY(1px) scale(.985); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--quiet { border-color: var(--hair); }
@media (hover: hover) {
  .btn:hover { background: var(--ink); color: var(--paper); }
  .btn--accent:hover { background: #244a3e; color: var(--on-accent); }
  .btn--quiet:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink); }
}
.btn[aria-busy='true'], .link[aria-busy='true'] { opacity: .5; pointer-events: none; }

/* ---- anchor -------------------------------------------------------------------------------- */
.anchor__line {
  font-size: 26px; line-height: 1.22; font-weight: 500; letter-spacing: -0.025em;
  max-width: 24ch; text-wrap: balance;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.anchor__line.is-empty { font-size: 18px; color: var(--soft); font-weight: 400; letter-spacing: 0; }
.anchor__line.is-swapping { opacity: 0; transform: translateY(4px); }

/* ---- energy -------------------------------------------------------------------------------- */
.energy { display: grid; grid-template-columns: repeat(3, 1fr); }
.energy button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 68px; padding: 12px 12px 10px;
  border: 1px solid var(--ink); margin-left: -1px; text-align: left;
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease);
}
.energy button:first-child { margin-left: 0; }
.energy__name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.energy__hint { font-size: 13px; color: var(--soft); transition: color .18s; }
.energy button[aria-checked='true'] { background: var(--ink); color: var(--paper); }
.energy button[aria-checked='true'] .energy__hint { color: #c9c4b8; }
@media (hover: hover) { .energy button[aria-checked='false']:hover { background: var(--paper-2); } }

.task-area { margin-top: 20px; }
.prompt { color: var(--soft); font-size: 16px; padding: 4px 0 8px; }
.prompt--done { color: var(--accent); font-weight: 550; padding-top: 14px; }

/* the low-energy floor task */
.floor { background: var(--paper-2); padding: 20px 18px 18px; }
.floor__lead { font-size: 14px; color: var(--soft); }
.floor__task { margin-top: 6px; font-size: 22px; line-height: 1.25; font-weight: 550; letter-spacing: -0.02em; max-width: 26ch; }
.floor__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.floor.is-done .floor__lead { color: var(--accent); font-weight: 550; }
.floor.is-done .floor__task { color: var(--soft); text-decoration: line-through; text-decoration-thickness: 1px; }

/* task rows */
.tasks { border-top: 1px solid var(--hair); }
.task { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 7px 0; border-bottom: 1px solid var(--hair); }
.check {
  flex: none; width: 26px; height: 26px; border: 1.5px solid var(--ink);
  display: grid; place-items: center;
  position: relative;
  transition: background-color .18s var(--ease), border-color .18s, transform .12s var(--ease);
}
.check::before { content: ''; position: absolute; inset: -9px; } /* 44px target */
.check svg { width: 16px; height: 16px; fill: none; stroke: var(--on-accent); stroke-width: 2; stroke-dasharray: 16; stroke-dashoffset: 16; transition: stroke-dashoffset .25s var(--ease) .05s; }
.check[aria-checked='true'] { background: var(--accent); border-color: var(--accent); }
.check[aria-checked='true'] svg { stroke-dashoffset: 0; }
.check.is-pop { animation: pop .32s var(--ease); }
@keyframes pop { 40% { transform: scale(1.14); } }
.task__text { flex: 1; min-width: 0; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.task__note { display: block; font-size: 13px; color: var(--accent); margin-top: 2px; }
.task.is-done .task__text { color: var(--soft); text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: var(--soft); }
.task__ctl { display: flex; gap: 4px; flex: none; }
.btn-2min {
  min-height: 36px; padding: 0 12px; border: 1px solid var(--accent); color: var(--accent);
  font-size: 14px; font-weight: 600; position: relative;
  transition: background-color .15s, color .15s, transform .12s var(--ease);
}
.btn-2min::before { content: ''; position: absolute; inset: -4px 0; }
@media (hover: hover) { .btn-2min:hover { background: var(--accent); color: var(--on-accent); } }

.add { display: flex; margin-top: 16px; }
.add input {
  flex: 1; min-width: 0; min-height: var(--tap); padding: 0 12px;
  border: 1px solid var(--ink); border-right: 0; background: transparent; border-radius: 0;
  font-size: 16px; /* 16px stops iOS zooming in */
}
.add input::placeholder { color: var(--soft); }
.add input:focus-visible { outline-offset: -2px; }

.later { margin-top: 20px; }
.later summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap);
  cursor: pointer; color: var(--soft); font-size: 14px; list-style: none;
}
.later summary::-webkit-details-marker { display: none; }
.later summary::before { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.later[open] summary::before { transform: rotate(45deg); }
.later:not([open]) .tasks--later { display: none; }
.tasks--later .task { min-height: 52px; }
.tasks--later .task__text { color: var(--soft); }

/* recovery */
.rest { background: var(--accent-pale); padding: 20px 18px; }
.rest__line { font-size: 22px; line-height: 1.25; font-weight: 550; letter-spacing: -0.02em; color: #1d3c32; max-width: 24ch; }
.rest__sub { margin-top: 8px; font-size: 15px; color: #2f4a40; }
.rest-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 24px; }
.rest-row__note { font-size: 14px; color: var(--soft); }

/* ---- reading -------------------------------------------------------------------------------- */
.feed-group + .feed-group { margin-top: 32px; }
.feed-group__head { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); }
h3 { font-size: 14px; font-weight: 600; color: var(--soft); }
.stories { border-top: 1px solid var(--hair); }
.story {
  display: grid; grid-template-columns: 1fr auto; column-gap: 16px;
  padding: 16px 0 10px; border-bottom: 1px solid var(--hair);
}
.story__link { display: block; text-decoration: none; grid-column: 1; }
.story__meta { display: block; font-size: 13px; color: var(--soft); }
.story__title { display: block; margin-top: 4px; font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; text-wrap: pretty; }
.story__preview { display: block; margin-top: 6px; font-size: 15px; line-height: 1.45; color: var(--soft); }
.story__img { grid-column: 2; grid-row: 1; width: 84px; height: 84px; overflow: hidden; background: var(--paper-2); margin-top: 4px; }
.story__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease), filter .3s, opacity .3s; }
@media (hover: hover) {
  .story__link:hover .story__title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
}
.story.is-read .story__title { color: var(--soft); font-weight: 500; }
.story.is-read .story__preview { display: none; }
.story.is-read .story__img img { filter: grayscale(1); opacity: .45; }

.save {
  grid-column: 1; justify-self: start;
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; margin-top: 2px; padding-right: 10px;
  font-size: 13px; color: var(--soft);
  transition: color .15s, transform .12s var(--ease);
}
.save svg { width: 12px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: fill .15s; }
.save.is-on { color: var(--accent); font-weight: 600; }
.save.is-on svg { fill: var(--accent); stroke: var(--accent); }
.save.is-pop svg { animation: pop .32s var(--ease); }
@media (hover: hover) { .save:hover { color: var(--ink); } }

.feed-status { padding: 8px 0; }
.feed-status p { color: var(--soft); }
.feed-status .btn { margin-top: 14px; }

.saved__list { border-top: 1px solid var(--hair); }
.saved__item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.saved__item a { flex: 1; min-width: 0; text-decoration: none; }
.saved__title { display: block; margin-top: 2px; font-size: 16px; line-height: 1.3; font-weight: 550; }
@media (hover: hover) { .saved__item a:hover .saved__title { text-decoration: underline; text-underline-offset: 3px; } }

/* ---- momentum ------------------------------------------------------------------------------- */
.momentum__sum { font-size: 16px; max-width: 40ch; margin-bottom: 16px; }
.momentum {
  display: grid; gap: 4px;
  grid-template-columns: 14px repeat(var(--weeks, 12), minmax(0, 1fr));
  max-width: 440px;
}
.momentum__months { display: contents; }
.momentum__months span, .momentum__day { font-size: 12px; color: var(--soft); line-height: 16px; }
.momentum__months span { grid-row: 1; white-space: nowrap; }
.momentum__day { grid-column: 1; align-self: center; }
.sq { display: block; aspect-ratio: 1; background: var(--empty); }
.sq--show { background: var(--accent); }
.sq--rest { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.sq--future { background: transparent; }
.sq--today { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 13px; color: var(--soft); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend .sq { width: 12px; }
.momentum__mark { margin-top: 8px; display: inline-block; }

/* ---- sheets (timer, settings) --------------------------------------------------------------- */
.sheet {
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0;
}
.sheet::backdrop { background: rgba(22, 21, 19, .4); }
.sheet[open] { animation: sheet-in .28s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } }

.timer__in {
  height: 100%; display: flex; flex-direction: column;
  padding: calc(28px + env(safe-area-inset-top)) var(--gutter) calc(24px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.timer__label { font-size: 15px; color: var(--soft); border-top: 2px solid var(--ink); padding-top: 12px; }
.timer__task { margin-top: 8px; font-size: 24px; line-height: 1.25; font-weight: 550; letter-spacing: -0.02em; }
.timer__clock {
  margin-top: auto; font-size: clamp(88px, 30vw, 132px); line-height: 1; font-weight: 500;
  letter-spacing: -0.05em; font-variant-numeric: tabular-nums;
}
.timer[data-phase='ended'] .timer__clock { color: var(--accent); }
.timer__track { height: 4px; background: var(--paper-2); margin: 20px 0 auto; overflow: hidden; }
.timer__track span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.timer__actions { display: grid; gap: 10px; margin-top: 32px; }
.timer__actions .btn { min-height: 54px; font-size: 16px; }

.settings__in { padding: calc(12px + env(safe-area-inset-top)) var(--gutter) calc(28px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.settings__in > .block__head { border-top: 2px solid var(--ink); padding-top: 8px; }
.field { display: block; margin-top: 24px; }
.field__name { display: block; font-weight: 600; font-size: 15px; }
.field__help { display: block; font-size: 14px; color: var(--soft); margin-top: 2px; max-width: 56ch; }
.field textarea {
  display: block; width: 100%; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--ink); border-radius: 0; background: #faf8f3;
  font-size: 16px; line-height: 1.5; resize: vertical;
}
.field textarea:focus-visible { outline-offset: -2px; }
.settings__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.settings__save { margin-top: 28px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  max-width: calc(100% - 40px); padding: 12px 16px;
  background: var(--ink); color: var(--paper); font-size: 15px;
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* phones: one column, reading straight after the tasks, the tracker last */
@media (max-width: 959px) {
  .cols { display: flex; flex-direction: column; }
  .col { display: contents; }
  .col--day > .block:last-child { order: 3; } /* showing up */
}

/* ---- larger screens ------------------------------------------------------------------------- */
@media (min-width: 640px) {
  :root { --gutter: 32px; }
  h1 { font-size: 32px; }
  .anchor__line { font-size: 28px; }
  .sheet.settings { width: min(640px, 100% - 48px); height: auto; max-height: calc(100% - 48px); margin: auto; box-shadow: 0 24px 60px rgba(22, 21, 19, .18); }
  .timer__actions { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  :root { --gutter: 40px; --block-gap: 64px; }
  .cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: 64px; align-items: start; }
  .title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-bottom: 36px; }
  .title-note { margin-top: 0; }
  .story__img { width: 104px; height: 104px; }
}

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