/* Agenda Sowsim. Tokens do Sowsim Design System v2 (genome.sowsim.com/ds/tokens.css):
   dois temas (escuro padrão, claro paper), azul constante, grain ligado nos dois,
   ação é link de texto (pill nunca é botão). */

@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url("/fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url("/fonts/instrument-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url("/fonts/instrument-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url("/fonts/instrument-sans-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Switzer"; font-weight: 100 900; font-display: swap; src: url("/fonts/Switzer-Variable.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-v24-latin_latin-ext-regular.woff2") format("woff2"); }

:root {
  /* constantes */
  --blue: #0000fe;
  --pink: #ff80b0;
  --on-blue: #f3f0ec;
  --font-h: "Instrument Sans", "Switzer", sans-serif;
  --font-b: "Switzer", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --px: clamp(20px, 5vw, 96px);
  --r-utility: 10px;

  /* tema escuro (padrão) */
  --bg: #050505;
  --fg: #f0f0f0;
  --fg-strong: #ffffff;
  --muted: #a39b91;     /* stone-400 */
  --quiet: #807870;     /* stone-500 */
  --off: #58524c;       /* bark-600: só estado desabilitado */
  --line: rgba(232, 223, 201, 0.12);
  --line-strong: rgba(232, 223, 201, 0.26);
  --field: rgba(243, 240, 236, 0.03);
  --field-focus: rgba(243, 240, 236, 0.06);
  --sel-ring: #f3f0ec;
  --grain: 0.04;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f0ec;
    --fg: #1c1a18;
    --fg-strong: #0a0908;
    --muted: #6b6259;
    --quiet: #6b6259;
    --off: #b3aa9d;
    --line: rgba(28, 26, 24, 0.12);
    --line-strong: rgba(28, 26, 24, 0.28);
    --field: rgba(255, 255, 255, 0.55);
    --field-focus: #ffffff;
    --sel-ring: #0000fe;
    --grain: 0.05;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--font-b);
  hyphens: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--blue); color: var(--on-blue); }
input, textarea { caret-color: var(--fg-strong); }
[hidden] { display: none !important; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

.shell { min-height: 100dvh; display: flex; flex-direction: column; padding: 0 var(--px); max-width: 1440px; margin: 0 auto; }

/* topo */
.top { display: flex; align-items: center; justify-content: space-between; padding: 28px 0; }
.logo { color: var(--fg-strong); display: block; }
.logo svg { display: block; height: 20px; width: auto; }
.lang { display: flex; align-items: center; gap: 2px; font: 400 0.72rem/1 var(--font-mono); letter-spacing: 0.06em; color: var(--off); }
.lang button { background: none; border: 0; padding: 8px 6px; color: var(--quiet); cursor: pointer; transition: color .3s var(--ease); }
.lang button:hover { color: var(--fg); }
.lang button[aria-pressed="true"] { color: var(--fg-strong); }

/* grade */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 112px);
  padding: clamp(24px, 6vh, 72px) 0 clamp(48px, 8vh, 96px);
  align-items: start;
  align-content: start;
}

h1 {
  margin: 0;
  font: 500 clamp(2.1rem, 4.2vw, 4.4rem)/1 var(--font-h);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--fg-strong);
}
.lede { margin: 24px 0 0; max-width: 42ch; color: var(--muted); font-size: clamp(1rem, 1.1vw, 1.125rem); text-wrap: pretty; }

.types { border: 0; padding: 0; margin: 40px 0 0; }
.types legend, .step-title, .tz-field > span, .hint {
  padding: 0; margin: 0 0 12px;
  font: 400 0.72rem/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--quiet);
}
.types-list { display: grid; gap: 8px; max-width: 30rem; }
.type {
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: baseline;
  text-align: left; padding: 16px 20px; border-radius: var(--r-utility);
  background: transparent; border: 1px solid var(--line); cursor: pointer;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.type:hover { border-color: var(--line-strong); }
.type[aria-pressed="true"] { border-color: var(--fg); background: var(--field); }
.type-min { font: 500 1.25rem/1.2 var(--font-h); letter-spacing: -0.02em; text-transform: uppercase; white-space: nowrap; color: var(--fg-strong); }
.type-name { font: 500 1rem/1.3 var(--font-b); }
.type-desc { grid-column: 2; color: var(--quiet); font-size: 0.9rem; line-height: 1.5; text-wrap: balance; }

.tz-field { display: grid; margin: 32px 0 0; max-width: 30rem; }
.tz-field > span { margin-bottom: 8px; }
select {
  appearance: none; width: 100%; padding: 12px 40px 12px 16px; border-radius: var(--r-utility);
  border: 1px solid var(--line); background: var(--field); cursor: pointer; font-size: 0.95rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23807870' stroke-width='1.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
  transition: border-color .3s var(--ease);
}
select:hover { border-color: var(--line-strong); }
select:focus { outline: none; border-color: var(--fg); }

/* painel */
.panel { min-width: 0; padding-top: 4px; }
.hint { margin-bottom: 20px; }

.picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(11rem, 13rem); gap: clamp(28px, 3.5vw, 56px); align-items: start; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-month { margin: 0; font: 500 clamp(1.2rem, 1.6vw, 1.5rem)/1.2 var(--font-h); letter-spacing: -0.02em; color: var(--fg-strong); }
.cal-month::first-letter { text-transform: uppercase; }
.cal-nav { display: flex; gap: 4px; }
.nav {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-utility);
  background: none; border: 1px solid transparent; color: var(--fg); cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.nav svg, .tl-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav:hover:not(:disabled) { border-color: var(--line-strong); }
.nav:disabled { color: var(--off); cursor: default; }

.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-week { margin-bottom: 6px; }
.cal-week span { text-align: center; font: 400 0.68rem/2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--quiet); }
.day {
  aspect-ratio: 1; min-height: 40px; max-height: 64px; display: grid; place-items: center;
  border-radius: var(--r-utility); border: 1px solid var(--line-strong); background: transparent;
  font: 500 1rem/1 var(--font-h); font-variant-numeric: tabular-nums; color: var(--fg-strong); cursor: pointer;
  transition: border-color .3s var(--ease), background-color .3s var(--ease), color .3s var(--ease);
}
.day:hover:not(:disabled) { border-color: var(--fg); }
.day:disabled { border-color: transparent; color: var(--off); font-weight: 400; cursor: default; }
.day[aria-pressed="true"] { background: var(--blue); border-color: var(--sel-ring); color: var(--on-blue); }

.times { min-width: 0; }
.times-title { margin: 0 0 16px; min-height: 44px; display: flex; align-items: center; font: 400 0.95rem/1.35 var(--font-b); color: var(--muted); text-wrap: balance; }
.slots { display: grid; gap: 8px; max-height: 26rem; overflow-y: auto; padding: 2px 4px 2px 2px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.slot-row { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: center; }
.slot-row.is-picked { grid-template-columns: 1fr auto; }
.slot {
  padding: 13px 8px; border-radius: var(--r-utility); border: 1px solid var(--line-strong); background: transparent;
  font: 500 1rem/1 var(--font-h); font-variant-numeric: tabular-nums; color: var(--fg-strong); cursor: pointer;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.slot:hover { border-color: var(--fg); }
.slot[aria-pressed="true"] { background: var(--blue); border-color: var(--sel-ring); color: var(--on-blue); }

.note, .state { color: var(--muted); margin: 20px 0 0; max-width: 46ch; }
.state { margin: 0; }
.note a, .state a, .msg a { color: inherit; }

/* link de texto: a ação da marca */
.tl {
  position: relative; display: inline-flex; align-items: center; gap: 0.3em;
  padding: 10px 0; min-height: 44px; background: none; border: 0; cursor: pointer; text-decoration: none;
  font: 400 clamp(1.05rem, 1.4vw, 1.4rem)/1.15 var(--font-h); letter-spacing: -0.01em; color: var(--fg-strong);
  transition: color .3s var(--ease), opacity .3s;
}
.tl-text {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%; background-repeat: no-repeat; background-size: 0% 1px;
  padding-bottom: 0.18em; transition: background-size .45s var(--ease);
}
.tl:hover .tl-text, .tl:focus-visible .tl-text { background-size: 100% 1px; }
.tl .tl-icon { width: 0.85em; height: 0.85em; transition: transform .4s var(--ease); }
.tl:hover .tl-icon:last-child { transform: translateX(0.18em); }
.tl:hover .tl-icon:first-child:not(:last-child) { transform: translateX(-0.18em); }
.tl:disabled { opacity: 0.5; cursor: progress; }
.tl-quiet { color: var(--muted); }
.tl-quiet:hover { color: var(--fg-strong); }
.tl-sm { font-size: clamp(0.92rem, 1vw, 1rem); }
.tl-go { font-size: 1rem; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px; margin-top: 24px; }

/* formulário */
.chosen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding: 0 0 20px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.chosen-when { margin: 0; font: 500 clamp(1.25rem, 1.8vw, 1.6rem)/1.25 var(--font-h); letter-spacing: -0.02em; text-wrap: balance; color: var(--fg-strong); }
.f { display: grid; gap: 8px; margin: 0 0 20px; }
.f > span { font-size: 0.9rem; color: var(--muted); }
.f em { font-style: normal; color: var(--quiet); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
input, textarea {
  width: 100%; padding: 13px 16px; border-radius: var(--r-utility);
  background: var(--field); border: 1px solid var(--line-strong);
  font-size: 1rem; line-height: 1.4; transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
textarea { resize: vertical; min-height: 7.5rem; }
input::placeholder, textarea::placeholder { color: var(--quiet); }
input:hover, textarea:hover { border-color: var(--fg); }
input:focus, textarea:focus { outline: none; border-color: var(--fg-strong); background: var(--field-focus); }
input[aria-invalid="true"] { border-color: var(--pink); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#ts-widget:not(:empty) { margin: 4px 0 20px; min-height: 65px; }
#submit { margin-top: 4px; }

.msg { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--r-utility); border: 1px solid rgba(255, 128, 176, 0.45); color: var(--fg); background: rgba(255, 128, 176, 0.08); }

/* confirmado e gestão */
.done-title { margin: 0; font: 500 clamp(1.6rem, 2.6vw, 2.4rem)/1.15 var(--font-h); letter-spacing: -0.02em; text-wrap: balance; color: var(--fg-strong); }
.done-text { margin: 20px 0 20px; max-width: 46ch; color: var(--muted); text-wrap: pretty; }
.confirm { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.confirm p { margin: 0; max-width: 46ch; }
#m-again { margin-top: 20px; }

/* rodapé */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 24px 0 32px; border-top: 1px solid var(--line); font: 400 0.8rem/1.5 var(--font-b); color: var(--quiet); }
.foot p { margin: 0; text-wrap: balance; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--fg-strong); }

:focus-visible { outline: 2px solid var(--fg-strong); outline-offset: 3px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
[tabindex="-1"]:focus { outline: none; }

.step:not([hidden]) { animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .picker { grid-template-columns: 1fr; }
  .times-title { min-height: 0; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); max-height: none; overflow: visible; padding: 0; }
  .slot-row.is-picked { grid-column: 1 / -1; grid-template-columns: minmax(6.5rem, 1fr) auto; }
}
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; gap: 40px; padding-top: 16px; }
  .lede { max-width: none; }
  .cal { max-width: 28rem; }
}
@media (max-width: 520px) {
  h1 { font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .lede { margin-top: 16px; font-size: 0.98rem; }
  .types { margin-top: 28px; }
  .types-list { grid-template-columns: 1fr 1fr; }
  .type { grid-template-columns: 1fr; row-gap: 2px; padding: 14px 16px; }
  .type-desc { grid-column: 1; font-size: 0.82rem; margin-top: 4px; }
  .tz-field { margin-top: 24px; }
  .grid { gap: 32px; }
  .f-row { grid-template-columns: 1fr; }
  .top { padding: 20px 0; }
  .cal-week, .cal-days { gap: 4px; }
}
@media (pointer: coarse) {
  .lang button { min-height: 44px; min-width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
