/* Letters from a hundred years ahead: a vertical timeline of advice */
.letters-page .nav { background: rgba(var(--bg-rgb), 0.55); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--line); }
.letters-page .nav nav a[aria-current="page"] { color: var(--future); }
.letters-page .nav .icon-btn { margin-left: 4px; }
.lt { position: relative; z-index: 2; max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* hero */
.lt-hero { padding: 150px 0 40px; max-width: 760px; }
.lt-hero h1 { margin-bottom: 22px; }
.lt-hero .lede { max-width: 620px; }
.lt-note { font: 11px/1.6 var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; max-width: 560px; }
.lt-hero-icons { display: flex; flex-wrap: wrap; gap: 14px; margin: 34px 0 28px; }

/* iOS-style squircle tiles whose glyph draws itself in */
.lt-app {
  --s: 52px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.28); display: grid; place-items: center; position: relative; flex: none;
  color: var(--future); border: 1px solid rgba(185, 166, 255, 0.35);
  background: linear-gradient(160deg, rgba(185, 166, 255, 0.16), rgba(185, 166, 255, 0.03)), var(--glass);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.lt-app .ic { width: 52%; height: 52%; }
.lt-hero-icons .lt-app { animation: bob 5s ease-in-out infinite; animation-delay: calc(var(--d) * 4); }
.lt-hero-icons .lt-app span { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.lt-app.sm { --s: 30px; border-radius: 9px; }
.lt-app.lg { --s: 58px; color: var(--maya); border-color: rgba(255, 106, 61, 0.4); background: linear-gradient(160deg, rgba(255, 106, 61, 0.14), rgba(255, 106, 61, 0.02)), var(--glass); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.draw path, .draw circle, .draw rect { stroke-dasharray: 100; stroke-dashoffset: 100; }
.ready .lt-hero-icons .draw *, .lt-entry.in .draw * { animation: draw 1.4s var(--ease) forwards; animation-delay: var(--d, 0s); }
.lt-entry.in .lt-node .draw * { --d: 0.05s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* year chips */
.lt-years {
  position: sticky; top: 80px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 8px; margin: 10px -8px 18px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--glass-edge);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.lt-years::-webkit-scrollbar { display: none; }
.lt-years a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  text-decoration: none; font: 500 12px var(--mono); color: var(--muted); transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.lt-years a .ic { width: var(--ic-min); height: var(--ic-min); }
.lt-years a:hover { color: var(--text); }
.lt-years a.active { color: #fff; background: var(--maya); }

.lt-future { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 30px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.lt-future .scenario { margin: 0; flex: 1; min-width: 280px; grid-template-columns: repeat(3, 1fr); }
.lt-future .scenario .full { display: inline; }
.lt-future .scenario .short { display: none; }

/* the timeline spine */
.lt-timeline { list-style: none; margin: 0; padding: 0; position: relative; --p: 0; }
.lt-timeline::before, .lt-timeline::after { content: ''; position: absolute; left: 28px; top: 0; width: 1px; }
.lt-timeline::before { bottom: 0; background: var(--line); }
.lt-timeline::after { height: calc(var(--p) * 100%); background: linear-gradient(var(--maya), var(--future)); }
.lt-entry { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 28px; padding: 0 0 70px; scroll-margin-top: 130px; }
.lt-node { position: sticky; top: 140px; align-self: start; display: grid; justify-items: center; gap: 8px; z-index: 1; }
.lt-year { font: 500 12px var(--mono); color: var(--text); background: var(--bg); padding: 2px 6px; border-radius: 6px; }

.lt-card {
  padding: 26px 28px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 40px 80px -40px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.lt-entry.in .lt-card { opacity: 1; transform: none; }
.lt-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px; }
.lt-from { display: inline-flex; align-items: center; gap: 7px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--future); }
.lt-from .ic { width: var(--ic-min); height: var(--ic-min); }
.lt-to { font-size: 13px; color: var(--muted); }
.lt-to em { font-style: normal; font-family: var(--sans); }
.lt-context { margin: 0 0 16px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
.lt-letter { margin: 0 0 18px; font-family: var(--display); font-weight: 300; font-size: clamp(19px, 2vw, 24px); line-height: 1.4; letter-spacing: -0.012em; color: var(--text); text-wrap: pretty; }
.lt-one {
  margin: 0 0 22px; display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 14px 16px; border-radius: 14px;
  font-size: 15px; line-height: 1.5; color: var(--future-text); background: rgba(185, 166, 255, 0.08); border: 1px solid rgba(185, 166, 255, 0.28);
}
.lt-one .ic { width: var(--ic-lg); height: var(--ic-lg); color: var(--future); }
.lt-dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; margin: 0 0 22px; }
.lt-dodont h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: #8fe3b0; }
.lt-dodont h4.no { color: #ff8f7a; }
.lt-dodont h4 .ic { width: var(--ic-min); height: var(--ic-min); }
.lt-dodont ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.lt-dodont li { margin: 0 0 4px; }
:root[data-theme="light"] .lt-dodont h4 { color: #1f9a57; }
:root[data-theme="light"] .lt-dodont h4.no { color: #d6452a; }

.lt-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lt-topic {
  padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line);
  opacity: 0; transform: translateY(10px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), border-color 0.3s;
  transition-delay: var(--d);
}
.lt-entry.in .lt-topic { opacity: 1; transform: none; }
.lt-topic:hover { border-color: rgba(185, 166, 255, 0.4); }
.lt-topic-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.lt-topic-head b { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.lt-topic .tip { margin: 0 0 6px; font-size: 14px; line-height: 1.45; font-weight: 500; color: var(--text); }
.lt-topic .why { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.lt-link {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; text-decoration: none;
  font-size: 13px; color: var(--text); background: var(--glass-weak); border: 1px solid var(--line); transition: border-color 0.3s, transform 0.3s var(--ease);
}
.lt-link:hover { border-color: var(--maya); transform: translateY(-1px); }
.lt-link .ic { width: var(--ic-min); height: var(--ic-min); }
.lt-link .turn { transform: rotate(45deg); }
:root[data-theme="light"] .lt-one { background: rgba(106, 80, 220, 0.06); border-color: rgba(106, 80, 220, 0.22); }
:root[data-theme="light"] .lt-app { border-color: rgba(106, 80, 220, 0.3); background: linear-gradient(160deg, rgba(106, 80, 220, 0.1), rgba(255, 255, 255, 0.6)); }
:root[data-theme="light"] .lt-app.lg { border-color: rgba(255, 106, 61, 0.4); background: linear-gradient(160deg, rgba(255, 106, 61, 0.12), rgba(255, 255, 255, 0.7)); }

.lt-end { padding: 40px 0 120px; text-align: center; }
.lt-end h2 { max-width: 760px; margin: 0 auto 26px; }
.lt-end .eyebrow { justify-content: center; }
.lt-back { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; background: var(--maya); color: #fff; text-decoration: none; font-weight: 500; }
.lt-back .ic { width: var(--ic-md); height: var(--ic-md); }

@media (max-width: 900px) {
  .lt { padding: 0 16px; }
  .lt-hero { padding: 110px 0 20px; }
  .lt-hero-icons { gap: 12px 10px; margin-bottom: 36px; }
  .lt-hero-icons .lt-app { --s: 46px; }
  .lt-years { top: 74px; margin: 6px 0 14px; }
  .lt-timeline::before, .lt-timeline::after { left: 19px; }
  .lt-entry { grid-template-columns: 1fr; gap: 12px; padding-bottom: 46px; }
  .lt-node { position: relative; top: 0; display: flex; align-items: center; justify-items: start; gap: 12px; }
  .lt-app.lg { --s: 40px; border-radius: 12px; }
  .lt-card { padding: 20px 16px; border-radius: 18px; }
  .lt-dodont { grid-template-columns: 1fr; }
  .lt-topics { grid-template-columns: 1fr; }
  .lt-future .scenario .full { display: none; }
  .lt-future .scenario .short { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .draw path, .draw circle, .draw rect { stroke-dashoffset: 0; }
  .lt-card, .lt-topic { opacity: 1; transform: none; }
}

/* refinements */
.lt-hero-icons { display: grid; grid-template-columns: repeat(6, 72px); gap: 0 8px; justify-items: center; }
.lt-hero-item { display: grid; justify-items: center; gap: 9px; }
.lt-hero-item > span { font: 9.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); text-align: center; }
.lt-hero-item .lt-app { animation: bob 5s ease-in-out infinite; animation-delay: calc(var(--d) * 4); }
.ready .lt-hero-item .draw * { animation: draw 1.4s var(--ease) forwards; animation-delay: var(--d, 0s); }
.lt-years { background: rgba(var(--bg-rgb), 0.82); }
.lt-future .scenario { min-width: 0; width: 100%; }
.lt-future .scenario button { font: 500 12.5px var(--sans); text-transform: none; letter-spacing: 0; justify-content: center; }
@media (max-width: 900px) {
  .lt-hero-icons { grid-template-columns: repeat(3, 1fr); gap: 4px 8px; }
  .lt-timeline::before, .lt-timeline::after { display: none; }
  .lt-future { flex-direction: column; align-items: stretch; gap: 8px; }
}

/* the plate at the top of each letter */
.lt-illo { margin: -8px -10px 20px; padding: 14px 12px 4px; border-radius: 16px; border: 1px solid var(--line); background: rgba(var(--bg-rgb), 0.35);
  background-image: linear-gradient(rgba(var(--ink-rgb), 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--ink-rgb), 0.035) 1px, transparent 1px); background-size: 20px 20px; }
@media (max-width: 700px) { .lt-illo { margin: -4px -6px 16px; padding: 8px 4px 2px; } }
/* before the script fills the timeline, hold its place so the ending doesn't flash in and jump away */
.lt-timeline:empty { min-height: 100vh; }

/* the advice block inside each letter */
.lt-advice { --av-text: var(--text-2); margin: 0 0 22px; }
.lt-advice .av-cols { grid-template-columns: 1fr 1fr; gap: 14px 26px; }
.lt-advice .av-list li { font-size: 14px; }
.lt-advice .av-extras { grid-template-columns: 1fr 1fr; gap: 16px 26px; margin-top: 18px; padding-top: 18px; }
.lt-advice .av-week { grid-column: 1 / -1; grid-template-columns: 150px 1fr; }
.lt-advice .av-week-svg { width: 150px; }
.lt-advice .av-week p { font-size: 15px; }
@media (max-width: 700px) {
  .lt-advice .av-cols, .lt-advice .av-extras { grid-template-columns: 1fr; }
  .lt-advice .av-week { grid-template-columns: 112px 1fr; }
  .lt-advice .av-week-svg { width: 112px; }
}
