/* The Weekend Project — a quiet section after the shelf.
   It speaks in this site's own type and spacing (11px kicker, 13px/2 body)
   and borrows the course's yellow marker stroke and its "Untitled, for now"
   app sticker. Like the postcard's back, you write straight onto the object:
   the sticker's title is the field. Below it, one reserved slot holds the hint
   and, once the app has a name, the way in — so nothing on the page moves.
*/

@font-face {
  font-family: "Gabarito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/gabarito.woff2") format("woff2");
}

.twp {
  --twp-b: #2F6BFF;
  --twp-ink: #17150F;
  --twp-card: #FFFFFF;
  --twp-muted: color-mix(in srgb, var(--text) 50%, transparent);
  --twp-rule: color-mix(in srgb, var(--text) 24%, transparent);
  --twp-ease: cubic-bezier(0.23, 1, 0.32, 1);
  /* a sticker on paper: a hairline edge, a contact shadow, then two soft lifts */
  --twp-shadow:
    0 0 0 0.5px rgba(42, 36, 24, 0.10),
    0 1px 1px rgba(42, 36, 24, 0.05),
    0 2px 4px -1px rgba(42, 36, 24, 0.06),
    0 8px 16px -4px rgba(42, 36, 24, 0.08),
    0 22px 36px -12px rgba(42, 36, 24, 0.14);
  --twp-shadow-lift:
    0 4px 8px -2px rgba(42, 36, 24, 0.04),
    0 14px 24px -6px rgba(42, 36, 24, 0.05),
    0 30px 48px -16px rgba(42, 36, 24, 0.10);
  margin: 0 0 64px;
  color: var(--text);
}
[data-theme="dark"] .twp {
  --twp-card: #1F1D19;
  --twp-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08), inset 0 0.5px 0 rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 12px 28px -8px rgba(0, 0, 0, 0.6);
  --twp-shadow-lift: 0 4px 8px -2px rgba(0, 0, 0, 0.2), 0 20px 40px -12px rgba(0, 0, 0, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .twp {
    --twp-card: #1F1D19;
    --twp-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08), inset 0 0.5px 0 rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 12px 28px -8px rgba(0, 0, 0, 0.6);
    --twp-shadow-lift: 0 4px 8px -2px rgba(0, 0, 0, 0.2), 0 20px 40px -12px rgba(0, 0, 0, 0.45);
  }
}

.twp .twp-label { margin: 0 0 6px; }

.twp-body { display: grid; grid-template-columns: minmax(0, 1fr) 264px; align-items: start; column-gap: 56px; }

.twp-text { text-wrap: pretty; }
.twp-text a { color: var(--text); font-weight: 500; text-decoration: underline dashed var(--pg-muted, #D8D4D0); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.twp-text a:hover { text-decoration-color: currentColor; }

/* The marker stroke: a slightly uneven yellow band, drawn left to right once
   the section comes into view. Text inside stays dark ink in every light. */
.twp-mark {
  padding: 0 3px;
  margin: 0 -1px;
  color: var(--twp-ink);
  font-weight: 500;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M1.5 6.2 C18 3.6 44 4.4 70 3.2 C82 2.7 92 3.1 98.6 2.4 L97.4 17.2 C80 18.4 58 16.9 36 18.2 C22 19 10 17.6 2.2 18.6 Z' fill='%23FFC629'/%3E%3C/svg%3E") left center / 100% 100% no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.twp.is-armed:not(.is-seen) .twp-mark { background-size: 0% 100%; }
.twp.is-seen .twp-mark { transition: background-size 650ms cubic-bezier(0.65, 0.05, 0.36, 1) 200ms; }

/* Attribution: the scribbled logo beside the link, the count underneath */
.twp-meta { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; }
.twp-logo { width: 20px; height: 20px; flex: 0 0 auto; color: var(--text); transform: rotate(-4deg); }
.twp-logo .twp-logo-ink { stroke: currentColor; }
.twp-meta .twp-logo { width: 34px; height: 34px; }
.twp-meta-text { display: grid; gap: 0; min-width: 0; }
.twp-count { font-size: 11px; line-height: 1.5; color: var(--pg-dot, #84817c); }
.twp-count .lang-stack { display: inline-grid; }
.twp-link { display: inline-flex; align-items: center; gap: 2px; justify-self: start; font-size: 13px; line-height: 1.6; color: var(--text); font-weight: 500; text-decoration: none; }
.twp-link span { text-decoration: underline dashed var(--pg-muted, #D8D4D0); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.twp-link:hover span { text-decoration-color: currentColor; }
.twp-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms var(--twp-ease); }
.twp-link:hover svg { transform: translate(1px, -1px); }
.twp-link:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }

/* ---------- the sticker ---------- */
.twp-side { display: grid; gap: 14px; padding-top: 4px; }

/* radius 18 ≈ the 6px inner rounding of the GET pill's box + 12 padding */
.twp-sticker {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
  padding: 12px 12px 12px 10px; border-radius: 18px;
  background: var(--twp-card); box-shadow: var(--twp-shadow);
  transform: rotate(-2.5deg);
  /* keeps the rotated edge and its shadow anti-aliased instead of stair-stepped */
  backface-visibility: hidden; outline: 1px solid transparent;
  cursor: text; position: relative;
  transition: transform 360ms var(--twp-ease);
}
/* the lifted shadow lives on its own layer and only fades, so lifting never repaints the card */
.twp-sticker::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--twp-shadow-lift); opacity: 0;
  transition: opacity 360ms var(--twp-ease);
}
@media (hover: hover) and (pointer: fine) {
  .twp-sticker:hover { transform: rotate(-1.75deg) translateY(-1px); }
  .twp-sticker:hover::after { opacity: 1; }
}
.twp-sticker:focus-within { transform: rotate(-1deg) translateY(-2px); }
.twp-sticker:focus-within::after { opacity: 1; }
.twp-sticker-icon { width: 52px; height: 52px; }
.twp-sticker-meta { display: grid; gap: 2px; min-width: 0; }

/* The title you write on: a dotted ruled line like the postcard's, solid while writing. */
.twp-name {
  display: block; width: 100%; min-width: 0; box-sizing: border-box;
  height: 26px; margin: 0; padding: 0 0 1px; border: 0; border-radius: 0; outline: none;
  background: repeating-linear-gradient(to right, var(--twp-rule) 0 3px, transparent 3px 6px) left bottom / 100% 1px no-repeat;
  font-family: "Gabarito", "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 15px; font-weight: 700; line-height: 25px; letter-spacing: 0; color: var(--text);
  caret-color: var(--twp-b);
  text-overflow: ellipsis;
}
.twp-name::placeholder { color: var(--text); opacity: 0.42; }
.twp-name:focus { background-image: linear-gradient(to right, color-mix(in srgb, var(--text) 50%, transparent) 0 100%); }
.twp-name:focus::placeholder { opacity: 0.26; }
.twp.has-name .twp-name:not(:focus) { background-image: none; }
.twp-sticker-by { font-size: 11px; line-height: 1.5; color: var(--twp-muted); white-space: nowrap; }
.twp-sticker-by .lang-stack { display: inline-grid; }

/* GET: quiet until the app has a name, then it fills in */
.twp-sticker-get {
  padding: 7px 12px; border-radius: 999px; line-height: 1;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  background: rgba(47, 107, 255, 0.09); color: var(--twp-b);
  transition: background-color 240ms ease, color 240ms ease;
}
.twp-sticker-get .lang-stack { display: inline-grid; justify-items: center; }
.twp.is-named .twp-sticker-get { background: var(--twp-b); color: #fff; }

/* The slot: hint and CTA share one grid cell, so its height never changes. */
.twp-slot { display: grid; }
.twp-slot > * { grid-area: 1 / 1; }

/* The nudge: the course's blue hand, an arrow drawn up to the title. */
.twp-hint {
  display: flex; align-items: flex-start; gap: 4px; margin: -4px 0 0 56px;
  font-family: "Gabarito", "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px; font-weight: 600; line-height: 1; color: var(--twp-b);
  transform: rotate(-3deg); transform-origin: left top;
  transition: opacity 160ms ease, transform 200ms var(--twp-ease), filter 160ms ease;
}
.twp-hint > span { padding-top: 17px; white-space: nowrap; }
.twp-hint-arrow { width: 30px; height: 27px; flex: 0 0 auto; overflow: visible; }
.twp-hint-arrow path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.twp.is-armed .twp-draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.twp.is-armed .twp-hint > span { opacity: 0; transform: translateY(3px); }
.twp.is-seen .twp-draw { stroke-dashoffset: 0; transition: stroke-dashoffset 520ms cubic-bezier(0.65, 0.05, 0.36, 1) 700ms; }
.twp.is-seen .twp-draw-head { transition-delay: 1180ms; transition-duration: 200ms; }
.twp.is-seen .twp-hint > span { opacity: 1; transform: none; transition: opacity 260ms ease 1000ms, transform 360ms var(--twp-ease) 1000ms; }
.twp.is-named .twp-hint { opacity: 0; transform: rotate(-3deg) translateY(-4px); filter: blur(2px); pointer-events: none; }

/* The way in: a line, then the button, each arriving a beat apart. */
.twp-cta { display: grid; gap: 10px; justify-items: start; align-content: start; padding-left: 4px; }
/* always two lines tall, whatever the name, so the slot never changes height */
.twp-cta-line { margin: 0; height: 3.2em; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 1.6; color: var(--pg-bio, #6F6F6F); text-wrap: pretty; }
.twp-cta-line b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.twp-cta-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 16px 0 18px; border-radius: 999px; line-height: 1;
  background: var(--twp-ink); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
  box-shadow: 0 1px 1px rgba(23, 21, 15, 0.08), 0 4px 10px -4px rgba(23, 21, 15, 0.4);
}
.twp-cta-btn .lang-stack { display: inline-grid; align-items: center; }
/* the button hugs whichever language is showing */
html:not([data-lang="ja"]) .twp-cta-btn .lang-layer[lang="ja"], html[data-lang="ja"] .twp-cta-btn .lang-layer[lang="en"] { display: none; }
.twp-cta-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms var(--twp-ease); }
.twp-cta-btn:hover svg { transform: translate(1px, -1px); }
.twp-cta-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
[data-theme="dark"] .twp-cta-btn { background: #F4EFE4; color: #17150F; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .twp-cta-btn { background: #F4EFE4; color: #17150F; box-shadow: none; } }

/* exit: quick and small, up and away */
.twp-cta-line, .twp-cta-btn {
  opacity: 0; transform: translateY(-3px); filter: blur(2px);
  transition: opacity 140ms ease, transform 160ms ease, filter 140ms ease;
}
/* enter: up from a little below, line first, button 90ms later */
.twp.is-named .twp-cta-line, .twp.is-named .twp-cta-btn {
  opacity: 1; transform: none; filter: none;
  transition: opacity 280ms ease, transform 420ms var(--twp-ease), filter 280ms ease;
}
.twp.is-named .twp-cta-btn { transition-delay: 90ms; }
.twp.is-arriving .twp-cta-line, .twp.is-arriving .twp-cta-btn { transform: translateY(6px); transition: none; }
.twp.is-named.is-settled .twp-cta-btn { transition: opacity 280ms ease, transform 150ms var(--twp-ease), filter 280ms ease; transition-delay: 0ms; }
.twp.is-named .twp-cta-btn:active { transform: scale(0.96); transition: transform 120ms ease; }

@media (max-width: 600px) {
  .twp-body { grid-template-columns: minmax(0, 1fr); row-gap: 36px; }
  .twp-side { width: 100%; max-width: 300px; justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .twp.is-seen .twp-mark, .twp-sticker, .twp-sticker::after, .twp-hint, .twp-cta-line, .twp-cta-btn, .twp-sticker-get { transition: opacity 160ms ease !important; }
  .twp.is-armed:not(.is-seen) .twp-mark { background-size: 100% 100%; }
  .twp.is-armed .twp-draw { stroke-dashoffset: 0; }
  .twp.is-armed .twp-hint > span { opacity: 1; transform: none; }
  .twp-cta-line, .twp-cta-btn, .twp.is-arriving .twp-cta-line, .twp.is-arriving .twp-cta-btn { transform: none; filter: none; }
}
