:root {
  --paper: #f7f1e8;
  --cream: #fdfbf7;
  --ink: #3a2a22;
  --mute: #7a6a60;
  --sage: #5c6f56;
  --line: rgba(58, 42, 34, 0.08);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --display: "Fraunces", serif;
  --sans: "Plus Jakarta Sans", sans-serif;
  --cal-gap: 0.35rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100dvh; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

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

.island {
  position: sticky;
  top: 1.25rem;
  z-index: 6;
  display: flex;
  gap: 1rem;
  align-items: center;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 1.25rem auto 0;
  padding: 0.4rem 0.45rem 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(253, 251, 247, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(58, 42, 34, 0.08);
}

.island nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.island button {
  border: 0;
  background: transparent;
  color: var(--mute);
  font: 500 0.78rem/1 var(--sans);
  letter-spacing: 0.04em;
  padding: 0.7rem 0.85rem;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.5s var(--ease), background 0.5s var(--ease), color 0.5s var(--ease);
}
.island button[aria-current="page"] {
  background: var(--ink);
  color: var(--cream);
}
.island button:active { transform: scale(0.98); }
.mark { font-family: var(--display); font-size: 0.95rem; white-space: nowrap; }
.sm { display: none; }

.stage {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 6rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sage);
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 1rem;
}
h1 { font-size: clamp(2.4rem, 8vw, 6.2rem); }
h2 { font-size: clamp(1.35rem, 4vw, 2.4rem); }
h3 { font-size: 1.15rem; text-transform: capitalize; }
.lead { max-width: 38rem; color: var(--mute); }

.shell {
  padding: 0.4rem;
  border-radius: 2rem;
  background: rgba(58, 42, 34, 0.045);
  animation: rise 0.8s var(--ease) both;
  min-width: 0;
}
.core {
  background: var(--cream);
  border-radius: calc(2rem - 0.4rem);
  padding: 1.5rem 1.6rem 1.7rem;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7);
  min-height: 100%;
  min-width: 0;
}

.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: auto; }

.stack { display: grid; gap: 0.55rem; }
.check, .field {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.65rem 0.2rem;
  border-top: 1px solid var(--line);
}
.field { grid-template-columns: 1fr; }
.field textarea, .field input[type="text"], .meta-row input {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0.9rem;
  background: rgba(58, 42, 34, 0.05);
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 16px;
  color: inherit;
}
.meta-row {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}
.meta-row label { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.meta-row input { width: 4.2rem; }

.salida-list, .reto-list, ul { list-style: none; padding: 0; margin: 0; }
.salida-list li, .reto-list li, ul li {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.reto-list li, ul li { grid-template-columns: auto 1fr auto; }
.idx { font-variant-numeric: tabular-nums; color: var(--mute); font-size: 0.8rem; }
.when { color: var(--mute); font-size: 0.8rem; }
.is-set .name { text-decoration: line-through; opacity: 0.7; }
small { color: var(--mute); }

.text-btn, .ghost, .icon-btn, .pick {
  border: 0;
  background: rgba(58, 42, 34, 0.06);
  color: var(--ink);
  font: 500 0.8rem/1 var(--sans);
  cursor: pointer;
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  min-height: 44px;
  touch-action: manipulation;
  transition: transform 0.45s var(--ease), background 0.45s var(--ease);
}
.icon-btn { width: 44px; height: 44px; padding: 0; }
.text-btn:active, .ghost:active, .icon-btn:active, .pick:active { transform: scale(0.98); }
.pick { display: block; width: 100%; text-align: left; margin: 0.35rem 0; padding: 0.85rem 1rem; }

.cal-core { overflow: hidden; }
.cal-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: space-between;
  align-items: end;
}
.cal-nav { display: flex; gap: 0.35rem; align-items: center; }
.cal-board {
  display: grid;
  gap: var(--cal-gap);
  margin-top: 1.1rem;
  min-width: 0;
}
.dows, .month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--cal-gap);
}
.dows {
  margin: 0;
  color: var(--mute);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-align: center;
}
.cell {
  min-height: 44px;
  min-width: 0;
  border: 0;
  text-align: center;
  background: rgba(58, 42, 34, 0.03);
  border-radius: 0.85rem;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  animation: rise 0.7s var(--ease) both;
  animation-delay: calc(var(--i) * 8ms);
  transition: transform 0.45s var(--ease), background 0.45s var(--ease);
}
.cell:active { transform: scale(0.98); }
.cell.mute { opacity: 0.38; }
.cell.today { background: rgba(92, 111, 86, 0.16); }
.cell.picked { box-shadow: inset 0 0 0 1px var(--sage); }
.num { font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.chips { display: none; flex-direction: column; gap: 0.2rem; width: 100%; }
.chip, .more {
  font-size: 0.62rem;
  background: var(--ink);
  color: var(--cream);
  border: 0;
  border-radius: 0.4rem;
  padding: 0.15rem 0.35rem;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.dots { display: flex; gap: 3px; justify-content: center; min-height: 6px; }
.dots i {
  width: 4px;
  height: 4px;
  border-radius: 99px;
  background: var(--sage);
  display: block;
}
.agenda { margin-top: 1.2rem; }
.agenda-list li {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.agenda-list .empty { color: var(--mute); border: 0; }
.hint { color: var(--mute); font-size: 0.85rem; margin: 1rem 0 0; }

blockquote { margin: 0 0 1rem; }
cite { display: block; font-style: normal; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sage); }
.giro {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.8rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.arrow { color: var(--sage); }

.drawer {
  position: fixed;
  z-index: 7;
  right: 1rem;
  bottom: 1rem;
  width: min(26rem, calc(100% - 2rem));
  max-height: 70dvh;
  overflow: auto;
}
.drawer-bar { display: flex; justify-content: space-between; align-items: center; }

@keyframes rise {
  from { opacity: 0; transform: translateY(1.1rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
  .bento { grid-template-columns: repeat(12, 1fr); }
  .span-4 { grid-column: span 4; }
  .span-5 { grid-column: span 5; }
  .span-6 { grid-column: span 6; }
  .span-7 { grid-column: span 7; }
  .span-8 { grid-column: span 8; }
  .span-12 { grid-column: span 12; }
  .core { padding: 2rem 2.1rem 2.2rem; }
  .stage { padding-top: 4.5rem; }
  .cell {
    min-height: 6.2rem;
    text-align: left;
    align-items: flex-start;
    padding: 0.45rem;
  }
  .chips { display: flex; }
  .dots { display: none; }
}

@media (max-width: 767px) {
  .island {
    position: fixed;
    top: auto;
    bottom: max(0.4rem, env(safe-area-inset-bottom));
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0.35rem;
    justify-content: stretch;
  }
  .mark { display: none; }
  .island nav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0;
  }
  .island button {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.15rem;
    font-size: 0.68rem;
    letter-spacing: 0;
  }
  .lg { display: none; }
  .sm { display: inline; }
  .stage {
    width: calc(100% - 1.25rem);
    padding: 0.85rem 0 calc(5.6rem + env(safe-area-inset-bottom));
  }
  .shell { border-radius: 1.35rem; padding: 0.28rem; }
  .core {
    border-radius: calc(1.35rem - 0.28rem);
    padding: 1rem 0.85rem 1.15rem;
  }
  .cell { animation: none; aspect-ratio: 1; }
  .salida-list li { grid-template-columns: 2rem 1fr; }
  .when, .salida-list .text-btn { grid-column: 2; }
  .giro { grid-template-columns: 1fr; }
  .arrow { display: none; }
  .drawer {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    bottom: calc(4.8rem + env(safe-area-inset-bottom));
    max-height: 52dvh;
  }
}
