/* Tre Parole — styles ported from the design canvas.
   Colour means word type; weight means emphasis. */

@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/archivo-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/archivo-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/archivo-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/archivo-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/archivo-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --ground: #E9EBEA;
  --ink: #111111;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --band-h: calc(var(--safe-top) + 18px);
  --screen-h: 100vh;
  color-scheme: light;
}
@supports (height: 100dvh) { :root { --screen-h: 100dvh; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ground); }
body {
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hit:focus-visible { outline: 2px solid #111111; outline-offset: 2px; }

#app { position: relative; max-width: 480px; height: var(--screen-h); margin: 0 auto; overflow: hidden; background: var(--ground); }
@media (min-width: 520px) { body { background: #DCDFDE; } }

/* ---------- Today: the calendar ---------- */
.home { height: var(--screen-h); display: flex; flex-direction: column; background: var(--ground); }
.home-head { padding: calc(var(--safe-top) + 28px) 24px 8px; display: flex; flex-direction: column; gap: 6px; }
.home-head .weekday { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #4A4A4A; }
.home-head h1 { margin: 0; font-size: 60px; font-weight: 800; letter-spacing: -0.045em; line-height: 0.9; }
.home-head p { margin: 6px 0 0; font-size: 16px; color: #4A4A4A; }

.cal { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column-reverse; gap: 6px; padding: 16px 16px 0; scrollbar-width: none; }
.cal::-webkit-scrollbar { display: none; }
.row { display: grid; grid-template-columns: 40px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; flex-shrink: 0; }
.gutter { display: flex; flex-direction: column; justify-content: center; gap: 2px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: #5A5A5A; }
.gutter.today { color: #111111; }

.cell { all: unset; position: relative; height: 84px; box-sizing: border-box; border-radius: 12px; border: 1.5px solid transparent; transition: background-color 0.3s, border-color 0.3s; }
.cell.closed { background: #FFFFFF; border: 1.5px dashed #AEB4B1; }
.cell.closed .inner { position: absolute; inset: 0; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; }
.cell .kind { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.cell .num { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: #C2C7C5; }
.cell.open { display: flex; align-items: center; justify-content: center; }
.cell.open svg { width: 32px; height: 32px; }
button.cell { cursor: pointer; }
button.cell:active { filter: brightness(0.96); }
button.cell:focus-visible { outline: 2px solid #111111; outline-offset: 2px; }

.home-foot { padding: 20px 16px calc(var(--safe-bottom) + 16px); }
.home-foot p { margin: 0; min-height: 68px; padding: 0 8px; display: flex; align-items: center; font-size: 15px; line-height: 1.4; color: #4A4A4A; }

.primary { all: unset; box-sizing: border-box; width: 100%; min-height: 68px; border-radius: 22px; background: #111111; color: #FFFFFF; font-family: 'Archivo', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; touch-action: manipulation; }
.primary:active { background: #2A2A2A; }
.primary:focus-visible { outline: 2px solid #111111; outline-offset: 3px; }

/* ---------- The three words: one continuous scroll ---------- */
.scroller { position: relative; height: var(--screen-h); overflow-y: auto; overscroll-behavior-y: none; -webkit-overflow-scrolling: touch; }
.band-wrap { position: sticky; top: 0; z-index: 3; height: 0; }
.band { position: absolute; top: 0; left: 0; right: 0; height: var(--band-h); transition: background-color 0.35s; }
.progress { position: absolute; left: 16px; right: 16px; bottom: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.seg { display: block; height: 4px; border-radius: 2px; background: rgba(17, 17, 17, 0.12); overflow: hidden; }
.seg .fill { display: block; height: 4px; width: 0; transition: width 0.3s; }

.pull { position: relative; will-change: transform; }
.topbar { padding: calc(var(--band-h) + 4px) 12px 0; display: flex; align-items: center; }
.back { all: unset; cursor: pointer; min-height: 44px; padding: 0 12px 0 2px; display: flex; align-items: center; gap: 2px; border-radius: 999px; font-family: 'Archivo', sans-serif; font-size: 16px; font-weight: 600; color: #111111; touch-action: manipulation; }
.back:focus-visible { outline: 2px solid #111111; outline-offset: 2px; }

/* A word page */
.word { color: #111111; padding-bottom: 40px; }
.word-head { position: relative; z-index: 0; overflow: hidden; min-height: 420px; padding: 32px 24px 36px; display: flex; flex-direction: column; justify-content: flex-end; }
.word-head .mark { position: absolute; z-index: -1; top: 8px; right: -56px; width: 280px; height: 280px; opacity: 0.13; pointer-events: none; }
.word-head .mark svg { width: 280px; height: 280px; display: block; }
.word-head .text { display: flex; flex-direction: column; gap: 14px; }
.word-head .kindline { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.word-head h1 { margin: 0; font-size: 54px; font-weight: 800; letter-spacing: -0.035em; line-height: 0.95; overflow-wrap: break-word; }
.word-head .pron { font-size: 14px; color: #4A4A4A; }
.rise { animation: tp-rise 0.7s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.sections { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.card { background: #FFFFFF; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: #5A5A5A; }
.card p { margin: 0; }
.meaning-card { gap: 8px; }
.meaning { font-size: 22px; font-weight: 700; line-height: 1.2; }
.body { font-size: 15px; line-height: 1.45; color: #222222; }
.small { font-size: 14px; line-height: 1.45; color: #333333; }

.rootbox { background: #F2F3F2; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.rootbox .label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #5A5A5A; }
.rootbox .form { font-size: 18px; font-weight: 700; }
.rootbox .gloss { font-size: 14px; color: #4A4A4A; }
.cognate { display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 12px; padding: 10px 0; border-top: 1px solid #ECECEC; }
.cognate .lang { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #5A5A5A; padding-top: 3px; }
.cognate .form { display: block; font-size: 17px; font-weight: 700; }
.cognate .note { display: block; font-size: 13px; color: #555555; margin-top: 2px; }

.family { display: flex; flex-direction: column; gap: 10px; }
.family-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.family-row .it { font-size: 17px; font-weight: 700; }
.family-row .en { font-size: 14px; color: #4A4A4A; text-align: right; }

.example { display: flex; flex-direction: column; gap: 3px; }
.example .it { font-size: 17px; line-height: 1.35; font-weight: 500; }
.example .en { font-size: 14px; line-height: 1.35; color: #4A4A4A; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 1px solid #111111; border-radius: 999px; padding: 4px 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }

.group { display: flex; flex-direction: column; gap: 6px; }
.group-title { font-size: 14px; font-weight: 700; }
.table { display: flex; flex-direction: column; border: 1px solid #E2E4E3; border-radius: 12px; overflow: hidden; }
.trow { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 12px; padding: 9px 12px; border-top: 1px solid #ECECEC; background: #FFFFFF; }
.trow:first-child { border-top: 0; }
.trow .it { font-size: 17px; line-height: 1.3; color: #6B6B6B; }
.trow .it b { color: #111111; font-weight: 800; }
.trow .en { font-size: 14px; line-height: 1.35; color: #4A4A4A; }

/* End of a word */
.recap { padding: 0 16px 72px; }
.recap .card { gap: 14px; }
.recap .word-big { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; }
.recap .gloss { font-size: 15px; color: #4A4A4A; }
.recap .pair { border-top: 1px solid #ECECEC; padding-top: 14px; display: flex; flex-direction: column; gap: 3px; }
.recap .pair .it { font-size: 17px; line-height: 1.35; font-weight: 500; }
.recap .pair .en { font-size: 14px; line-height: 1.35; color: #4A4A4A; }

/* The threshold between words */
.seam { position: relative; }
.peek { position: relative; height: 200px; }
.pill { all: unset; box-sizing: border-box; position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%); z-index: 2; min-height: 60px; padding: 0 26px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 10px 28px rgba(17, 17, 17, 0.14), 0 1px 2px rgba(17, 17, 17, 0.12); overflow: hidden; display: flex; align-items: center; gap: 10px; cursor: pointer; white-space: nowrap; font-family: 'Archivo', sans-serif; font-size: 17px; font-weight: 700; color: #111111; touch-action: manipulation; }
.pill:focus-visible { outline: 2px solid #111111; outline-offset: 3px; }
.pill .pill-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.pill svg, .pill .pill-label { position: relative; }
.pill svg { animation: tp-nudge 1.6s ease-in-out infinite; }
.peek-label { position: absolute; left: 24px; bottom: calc(28px + var(--safe-bottom)); font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

/* Fatto. */
.done { min-height: var(--screen-h); display: flex; flex-direction: column; padding: 0 16px calc(var(--safe-bottom) + 16px); background: var(--ground); }
.done .msg { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 0 8px 40px; }
.done h2 { margin: 0; font-size: 64px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.done p { margin: 0; font-size: 19px; line-height: 1.4; color: #4A4A4A; }

/* Revisiting one word */
.review .topbar { padding-top: calc(var(--safe-top) + 8px); }
.review .word { padding-bottom: calc(var(--safe-bottom) + 48px); }

@keyframes tp-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes tp-rise { from { transform: translateY(36px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .rise, .pill svg { animation: none !important; }
  .seg .fill, .band, .cell { transition: none !important; }
}
