/* ==========================================================================
   Peach · One Line profile
   Off-white paper, black ink, one ballpoint blue. Based on the Journey page.
   ========================================================================== */

:root {
  --color-bg: #f6f3ee;
  --color-text: #000;
  --color-muted: #666666;   /* 5.2:1 on the paper colour (WCAG AA for small, light text) */
  --color-rule: #ddd7cc;
  --color-card: #fff;
  --color-ph: #e8e4dc;
  --marker: #1f45d6;
  --marker-soft: rgba(31, 69, 214, 0.28);
  --font-sans: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-hand: "Square Peg", "Bradley Hand", cursive;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem; --text-lg: 1.25rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px; --space-10: 128px;
  --page-gutter: clamp(1.25rem, 5vw, 4rem);
  --tracking-tight: -0.03em; --tracking-wide: 0.08em;
  --radius-full: 999px;
  --shell-height: 0px;
  color-scheme: light;
}
html[lang="th"] {
  --font-sans: "Poppins", "Prompt", "Helvetica Neue", Arial, sans-serif;
  --font-hand: "Square Peg", "Mali", cursive;
}
html[lang="th"] body { line-height: 1.7; }
html[lang="th"] .note__text, html[lang="th"] .toolcard li, html[lang="th"] .frame__caption { font-size: 1.35rem; line-height: 1.35; }

body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); }
.eyebrow { font-size: var(--text-xs); font-weight: 500; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.brand { font-size: var(--text-sm); font-weight: 500; }
mark { background: none; color: inherit; }
.muted { color: var(--color-muted); }

/* ---- Top bar --------------------------------------------------------------- */
.topbar {
  position: fixed; top: env(safe-area-inset-top, 0px); right: 0; z-index: 50;
  display: flex; gap: var(--space-2); padding: var(--space-4) var(--page-gutter);
}
.topbar a {
  font-size: var(--text-xs); font-weight: 500; padding: 6px 12px; border-radius: var(--radius-full);
  background: rgba(246, 243, 238, 0.86); backdrop-filter: blur(6px); color: var(--color-text);
}
.topbar a:hover { background: var(--color-text); color: var(--color-bg); }

/* ---- Hero ------------------------------------------------------------------ */
.hero {
  position: relative; overflow: hidden; min-height: 100vh; min-height: 100svh;
  padding: var(--space-8) var(--page-gutter) var(--space-8);
  display: grid; place-items: center;
}
.hero__copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); max-width: min(92vw, 1000px); }
.headline { font-weight: 300; letter-spacing: var(--tracking-tight); margin-top: var(--space-2); font-size: clamp(2.75rem, 8vw, 7.5rem); line-height: 0.98; text-wrap: balance; }
html[lang="th"] .headline { line-height: 1.12; letter-spacing: -0.01em; }
.headline__line { display: block; }
.headline__line div { display: inline-block; }
.support { font-size: var(--text-lg); font-weight: 400; color: var(--color-muted); max-width: 36ch; margin-top: var(--space-2); text-wrap: balance; }
.hero__arrow { width: 56px; height: 56px; margin-top: var(--space-4); color: var(--color-text); overflow: visible; }
.hero .hero__polaroid { position: absolute; z-index: 3; right: clamp(24px, 7vw, 120px); top: 16%; width: clamp(130px, 13vw, 190px); transform: rotate(6deg); }
.badge { position: absolute; right: var(--page-gutter); bottom: var(--space-8); width: 110px; height: 110px; animation: spin 14s linear infinite; }
.badge text { font-family: var(--font-sans); font-size: 11px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; fill: var(--color-text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Story + the thread ---------------------------------------------------- */
.story { position: relative; padding: var(--space-8) var(--page-gutter) var(--space-10); display: flex; flex-direction: column; gap: 32vh; }
.thread { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--color-text); pointer-events: none; overflow: visible; }
.doodles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.doodle { position: absolute; color: #000; overflow: visible; }
.scribble { position: absolute; width: clamp(70px, 8vw, 110px); height: auto; color: var(--color-text); pointer-events: none; overflow: visible; z-index: 3; }

.chapter { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: center; width: min(100%, 980px); }
.chapter--photo-left { align-self: flex-end; }
.chapter--photo-right .chapter__photo { order: 2; }
.chapter--photo-left .scribble { left: 40%; top: -6%; transform: rotate(14deg); }
.chapter--photo-right .scribble { right: -3%; top: -10%; transform: rotate(-10deg); }
.chapter__copy { display: flex; flex-direction: column; gap: var(--space-3); background: var(--color-bg); padding: var(--space-4) 0; }
.chapter__title { font-size: clamp(2rem, 4.5vw, 3.75rem); font-weight: 300; letter-spacing: var(--tracking-tight); line-height: 1; text-wrap: balance; }
html[lang="th"] .chapter__title { line-height: 1.2; letter-spacing: 0; }
.chapter__text { font-size: var(--text-lg); font-weight: 300; max-width: 36ch; }
.facts { display: grid; gap: 2px; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); }
.facts li::before { content: "· "; }

/* ---- Pinned cards ---------------------------------------------------------- */
.chapter__photo { position: relative; clip-path: inset(-30% -30% 130% -30%); transform: rotate(-2deg); }
.pinned { position: relative; }
.card__shadow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: blur(5px); opacity: 0.3; transform: translate(-6px, 6px); pointer-events: none; }
[data-shadow="deep"] > .card__shadow { filter: blur(6px); opacity: 0.5; transform: translate(-10px, 10px); }
.card { position: relative; padding: 24px 24px 28px; background: var(--color-card); border-radius: 2px; }
.card__texture { position: absolute; inset: 0; border-radius: 2px; background-image: url("/images/paper.png"); background-repeat: repeat; pointer-events: none; }
.chapter__img { position: relative; aspect-ratio: 4 / 5; background-size: cover; background-position: center; background-color: var(--color-ph); mix-blend-mode: multiply; }
.pin { position: absolute; top: -10px; left: 50%; width: 24px; height: 24px; transform: translateX(-50%) rotate(-6deg); filter: drop-shadow(-3px 3px 3px rgba(0, 0, 0, 0.55)); pointer-events: none; z-index: 2; }
.mini { position: absolute; width: 52%; z-index: 2; transform: rotate(var(--tilt, 6deg)); }
.mini .card { padding: 14px 14px 18px; }
.mini .chapter__img { aspect-ratio: 4 / 3; }
.mini--br { right: -14%; bottom: -12%; }
.mini--bl { left: -14%; bottom: -10%; }

/* Empty frame waiting for a real photo */
.frame { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; text-align: center; padding: 8px;
  border: 1.5px dashed #a29d94; background: repeating-linear-gradient(-45deg, transparent 0 9px, rgba(0,0,0,.035) 9px 10px); }
.frame--portrait { aspect-ratio: 4 / 5; }
.frame__caption { font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.05; color: #58544e; }
.frame.has-photo { border: 0; background: var(--color-ph) center / cover no-repeat; mix-blend-mode: multiply; }
.frame.has-photo .frame__caption { display: none; }

/* ---- Note cards ------------------------------------------------------------ */
.note { position: relative; align-self: flex-start; width: min(100%, 260px); margin: -11vh 0; transform: rotate(var(--tilt, -2deg)); z-index: 2; }
.card--note { padding: 18px 22px 20px; }
.note__text { position: relative; font-family: var(--font-hand); font-size: 1.8rem; line-height: 1.15; text-align: center; }

/* ---- Section heads (pinboard, toolbox, certificates) ----------------------- */
.block { position: relative; z-index: 2; width: min(100%, 1120px); align-self: center; display: flex; flex-direction: column; gap: var(--space-6); }
.block__head { background: var(--color-bg); padding: var(--space-3) var(--space-4) var(--space-3) 0; display: grid; gap: var(--space-2); max-width: 60ch; }
.block__title { font-size: clamp(2rem, 4.5vw, 3.5rem); font-weight: 300; letter-spacing: var(--tracking-tight); line-height: 1; }
html[lang="th"] .block__title { line-height: 1.2; letter-spacing: 0; }
.block__intro { font-size: var(--text-base); color: var(--color-muted); background: var(--color-bg); }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); background: var(--color-bg); padding: 4px 0; }
.chip { font-size: var(--text-xs); font-weight: 500; padding: 7px 14px; border-radius: var(--radius-full); box-shadow: 0 0 0 1.5px var(--color-text) inset; background: var(--color-bg); }
.chip[aria-pressed="true"] { background: var(--color-text); color: var(--color-bg); }
.chip span { opacity: 0.55; margin-left: 4px; }

.group { display: grid; gap: var(--space-4); }
.group[hidden] { display: none; }
.group__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; background: var(--color-bg); width: fit-content; padding-right: var(--space-3); }
.group__title { font-size: 1.5rem; font-weight: 300; letter-spacing: -0.02em; }
.group__caption { font-size: var(--text-sm); color: var(--color-muted); }

/* Index cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-7) var(--space-6); padding-top: var(--space-3); }
.icard { position: relative; text-align: left; width: 100%; transform: rotate(var(--tilt, 0deg)); transition: transform 0.25s ease; }
.icard:hover, .icard:focus-visible { transform: rotate(0deg) translateY(-4px); }
.icard .card { padding: 22px 20px 20px; min-height: 100%; display: flex; flex-direction: column; gap: 6px;
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(31, 69, 214, 0.1) 27px 28px); background-position: 0 58px; }
.icard__ind { font-size: 0.68rem; font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--color-muted); }
.icard__title { font-size: 1.25rem; font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; }
.icard__one { font-size: var(--text-sm); font-weight: 300; }
.icard__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 8px; }
.icard__tags i { font-style: normal; font-size: 0.66rem; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-full); box-shadow: 0 0 0 1px var(--color-rule) inset; background: var(--color-bg); }
.icard__more { font-size: var(--text-xs); font-weight: 500; color: var(--marker); }
.icard > .card { height: 100%; }
.icard { display: block; height: 100%; }
.cards > li { display: flex; }

/* Case study dialog */
.case { border: 0; padding: 0; background: transparent; width: min(92vw, 720px); max-height: 88vh; overflow: visible; }
.case::backdrop { background: rgba(20, 18, 15, 0.45); backdrop-filter: blur(2px); }
.case .card { padding: clamp(24px, 4vw, 44px); max-height: 88vh; overflow: auto; display: grid; gap: var(--space-4); }
.case__close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; background: var(--color-text); color: var(--color-bg); font-size: 1.2rem; }
.case__title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 300; letter-spacing: var(--tracking-tight); line-height: 1.05; padding-right: 40px; }
.case__one { font-size: var(--text-lg); }
.case dl { display: grid; gap: var(--space-4); margin: 0; }
.case dt { font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--marker); }
.case dd { margin: 4px 0 0; font-weight: 300; }
.case__stack { display: flex; flex-wrap: wrap; gap: 6px; }
.case__stack i { font-style: normal; font-size: var(--text-xs); font-weight: 500; padding: 3px 10px; border-radius: var(--radius-full); background: var(--color-bg); }
.case__share { justify-self: start; font-size: var(--text-xs); font-weight: 500; padding: 7px 14px; border-radius: var(--radius-full); box-shadow: 0 0 0 1.5px var(--color-text) inset; }
.icard__detail { display: none; }

/* Toolbox */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-7) var(--space-6); }
.toolcard { transform: rotate(var(--tilt, 0deg)); }
.toolcard .card { padding: 20px 22px 22px; }
.toolcard h3 { font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: 8px; }
.toolcard li { font-family: var(--font-hand); font-size: 1.6rem; line-height: 1.12; }
.langs { background: var(--color-bg); width: fit-content; font-size: var(--text-sm); }

/* Certificates */
.certs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-6); }
.cert .card { padding: 20px 20px 18px; display: grid; gap: 6px; height: 100%; }
.cert { transform: rotate(var(--tilt, 0deg)); display: flex; }
.cert .pinned { width: 100%; }
.cert__name { font-size: 1rem; font-weight: 400; line-height: 1.3; }
.cert__meta { font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); }
.more { background: var(--color-bg); }
.more summary { cursor: pointer; font-size: var(--text-sm); font-weight: 500; width: fit-content; padding: 6px 0; }
.more ul { display: grid; gap: 6px; margin-top: 10px; font-size: var(--text-sm); }
.more li span { color: var(--color-muted); }
.edu { display: grid; gap: var(--space-3); background: var(--color-bg); width: fit-content; max-width: 62ch; }
.edu li { display: grid; }
.edu b { font-weight: 400; }
.edu span { font-size: var(--text-sm); color: var(--color-muted); }

/* Closing */
.chapter--center { grid-template-columns: 1fr; justify-items: center; text-align: center; align-self: center; gap: var(--space-4); padding: var(--space-8) var(--space-6); background: var(--color-bg); }
.chapter__title--big { font-size: clamp(2.5rem, 7vw, 6rem); }
.buttons { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-3); }
.button { padding: 12px 30px; border-radius: var(--radius-full); background: var(--color-text); color: var(--color-bg); font-size: var(--text-sm); font-weight: 500; }
.button--ghost { background: transparent; color: var(--color-text); box-shadow: 0 0 0 1.5px var(--color-text) inset; }
.availability { font-size: var(--text-sm); color: var(--color-muted); }

.footer { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); padding: var(--space-8) var(--page-gutter); }

/* ---- Phones ---------------------------------------------------------------- */
@media (max-width: 760px) {
  .story { gap: 22vh; }
  .chapter { grid-template-columns: 1fr; gap: var(--space-6); }
  .chapter--photo-right .chapter__photo { order: 0; }
  .chapter__photo { width: min(84%, 330px); }
  .mini--bl, .mini--br { left: auto; right: -12%; bottom: -12%; }
  .scribble, .badge, .story .doodles { display: none; }
  .hero .hero__polaroid { position: relative; right: auto; top: auto; order: -1; width: 120px; margin-bottom: var(--space-3); }
  .note { margin: -8vh 0; }
  .topbar { left: 0; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .badge { animation: none; }
  .chapter__photo { clip-path: none; transform: none; }
  .icard { transition: none; }
}

/* ---- Print (the story prints as a plain document; use /cv for the CV) ------ */
@media print {
  .topbar, .badge, .doodles, .thread, .scribble, .hero__arrow { display: none !important; }
  .chapter__photo { clip-path: none !important; transform: none !important; }
}

/* ---- Round 2 --------------------------------------------------------------- */
.eyebrow strong { font-weight: 700; }
.case__share { margin-top: var(--space-4); }

/* Certificates open a viewer */
.cert__btn { display: block; width: 100%; height: 100%; text-align: left; cursor: pointer; transition: transform 0.25s ease; }
.cert__btn:hover, .cert__btn:focus-visible { transform: translateY(-4px) rotate(calc(var(--tilt, 0deg) * -1)); }
.cert__btn .card { display: grid; gap: 6px; height: 100%; }
.cert__view { font-size: var(--text-xs); font-weight: 500; color: var(--marker); margin-top: 4px; }
.more__btn { font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--marker); text-underline-offset: 3px; cursor: pointer; }
.certview { width: min(94vw, 980px); }
.certview .card { gap: var(--space-4); }
.certview__title { font-size: 1.25rem; font-weight: 400; letter-spacing: -0.02em; padding-right: 48px; }
.certview__imgs { display: grid; gap: var(--space-4); }
.certview__imgs.is-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.certview__imgs img { width: 100%; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px var(--color-rule); background: var(--color-ph); }

/* Scroll to top: appears after the hero, ring shows how far along the line you are */
.totop {
  position: fixed; z-index: 40; right: calc(var(--page-gutter) - 4px); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%; background: rgba(246, 243, 238, 0.92); backdrop-filter: blur(6px);
  box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.14); display: grid; place-items: center;
  opacity: 0; transform: translateY(16px) scale(0.9); pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease;
}
.totop.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.totop svg { width: 52px; height: 52px; transform: rotate(-90deg); overflow: visible; }
.totop__track { fill: none; stroke: var(--color-rule); stroke-width: 2; }
.totop__ring { fill: none; stroke: var(--marker); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 132; stroke-dashoffset: 132; transition: stroke-dashoffset 0.15s linear; }
.totop__arrow { fill: none; stroke: var(--color-text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); transform-origin: 24px 24px; }
.totop:hover { background: var(--color-text); }
.totop:hover .totop__arrow { stroke: var(--color-bg); }
.totop:focus-visible { outline: 2px solid var(--marker); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .totop, .totop__ring, .cert__btn { transition: none; } }
@media print { .totop { display: none !important; } }
.edu__proof { justify-self: start; margin-top: 4px; font-size: var(--text-sm); font-weight: 500; color: var(--marker); }

/* Contact: buttons + LINE QR card */
.contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-6); margin-top: var(--space-3); }
.contact .buttons { max-width: 560px; margin-top: 0; }
.lineqr { display: block; width: 180px; transform: rotate(var(--tilt, -3deg)); transition: transform 0.25s ease; }
.lineqr:hover, .lineqr:focus-visible { transform: rotate(0deg) translateY(-4px); }
.lineqr .card { padding: 18px 18px 14px; display: grid; justify-items: center; gap: 4px; }
.lineqr img { width: 132px; height: 132px; image-rendering: pixelated; position: relative; }
.lineqr__cap { font-family: var(--font-hand); font-size: 1.45rem; line-height: 1; margin-top: 6px; }
.lineqr__id { font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); }

/* Hero waits for the fonts (max ~0.5 s) so the intro starts clean, never blank for long */
.js:not(.is-ready) .hero__copy, .js:not(.is-ready) .hero__polaroid { opacity: 0; animation: ready-fallback 0s 1.5s forwards; }
@keyframes ready-fallback { to { opacity: 1; } }

/* Music toggle, bottom left */
.music {
  position: fixed; z-index: 40; left: calc(var(--page-gutter) - 4px); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 14px; border-radius: var(--radius-full);
  background: rgba(246, 243, 238, 0.92); backdrop-filter: blur(6px); box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.14);
  font-size: var(--text-xs); font-weight: 500; color: var(--color-text); cursor: pointer; transition: background 0.2s ease;
}
.music:hover { background: #fff; }
.music:focus-visible { outline: 2px solid var(--marker); outline-offset: 3px; }
.music__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.music__bars i { display: block; width: 3px; height: 4px; border-radius: 2px; background: var(--color-text); }
.music.is-on .music__bars i { background: var(--marker); animation: eq 1.1s ease-in-out infinite; }
.music.is-armed .music__bars i { background: var(--marker); opacity: .55; }   /* waiting for a tap on this page */
.music.is-armed .music__bars i:nth-child(2), .music.is-armed .music__bars i:nth-child(4) { height: 8px; }
.music.is-on .music__bars i:nth-child(2) { animation-delay: -0.3s; }
.music.is-on .music__bars i:nth-child(3) { animation-delay: -0.6s; }
.music.is-on .music__bars i:nth-child(4) { animation-delay: -0.9s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.music.is-hint:not(.is-on) { box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.14), 0 0 0 2px var(--marker); }
@media (max-width: 760px) { .music__label { display: none; } .music { padding: 0 14px; } }
@media (prefers-reduced-motion: reduce) { .music.is-on .music__bars i { animation: none; height: 10px; } }
@media print { .music { display: none !important; } }

/* Photos open full size */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid var(--marker); outline-offset: 4px; }
.frame.zoomable:not(.has-photo) { cursor: default; }
.certview.is-photo { width: min(96vw, 1200px); }
.certview.is-photo .certview__imgs img { max-height: 76vh; width: auto; max-width: 100%; justify-self: center; box-shadow: none; }

/* Dialogs: keep the brass pin whole. The card no longer scrolls (that clipped the pin);
   the content inside it scrolls instead. */
.case .card { overflow: visible; max-height: none; }
.case__body { max-height: calc(88vh - 2 * clamp(24px, 4vw, 44px)); overflow: auto; display: grid; gap: var(--space-4); padding-right: 4px; }
.certview__imgs { max-height: calc(88vh - 150px); overflow: auto; }
.certview.is-photo .certview__imgs { overflow: auto; }
.case .pin { top: -12px; z-index: 4; }

/* ---- Ballpoint cursor (js/cursor.js) ------------------------------------------
   Only active with a mouse/trackpad; html.has-cursor is added by the script.
   .cursor__ring / .cursor__dot are moved by JS (transform only); everything that
   grows or squashes lives on an inner element, so sizing never shifts the position. */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor :is(input, textarea, select, [contenteditable="true"]) { cursor: text !important; }
.cursor { position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .25s; }
.cursor.is-visible { opacity: 1; }
.cursor[data-mode="text"] { opacity: 0; }
.cursor__ink { position: absolute; inset: 0; width: 100%; height: 100%; }
.cursor__dot, .cursor__ring { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.cursor__dot::before {
  content: ""; position: absolute; left: -3.5px; top: -3.5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--marker); box-shadow: 0 0 0 1.5px var(--color-bg);
  transition: transform .15s, opacity .2s;
}
.cursor__bubble {
  position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .28) inset;
  display: grid; place-items: center;
  transition: left .28s cubic-bezier(.2,.8,.2,1), top .28s cubic-bezier(.2,.8,.2,1), width .28s cubic-bezier(.2,.8,.2,1), height .28s cubic-bezier(.2,.8,.2,1), background-color .2s, box-shadow .2s, transform .15s;
}
.cursor__label {
  font: 500 11px/1 var(--font-sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-bg); opacity: 0; transition: opacity .15s; white-space: nowrap;
}
html[lang="th"] .cursor__label { text-transform: none; letter-spacing: 0; font-size: 12px; }
/* over links and buttons: the ring opens up, the tip stays */
.cursor:is([data-mode="link"], [data-mode="out"], [data-mode="pdf"], [data-mode="open"], [data-mode="view"]) .cursor__bubble {
  left: -26px; top: -26px; width: 52px; height: 52px; box-shadow: 0 0 0 1.5px var(--color-text) inset;
}
/* with a label: a solid ink bubble */
.cursor.has-label .cursor__bubble { left: -34px; top: -34px; width: 68px; height: 68px; background: var(--color-text); box-shadow: none; }
.cursor.has-label .cursor__label { opacity: 1; }
.cursor.has-label .cursor__dot::before { opacity: 0; }
.cursor[data-mode="out"] .cursor__label { font-size: 18px; }
/* pressing: squash around the centre (transform-origin is the centre of the bubble) */
.cursor.is-down .cursor__bubble { transform: scale(.82); }
.cursor.is-down .cursor__dot::before { transform: scale(.7); }

/* ---- Top menu on phones: five links must fit one row ---------------------------- */
@media (max-width: 560px) {
  .topbar { gap: 4px; padding: var(--space-3) 10px; flex-wrap: wrap; }
  .topbar a { padding: 6px 9px; font-size: 0.7rem; }
}
.topbar a[aria-current="page"] { background: var(--color-text); color: var(--color-bg); }

/* ---- Post cards (blog list, tag pages, "Latest writing" on the home page) ------ */
.postlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: var(--space-7) var(--space-6); }
.postcard { display: flex; transform: rotate(var(--tilt, 0deg)); transition: transform .25s ease; }
.postcard:hover, .postcard:focus-within { transform: rotate(0deg) translateY(-4px); }
.postcard > a { display: block; width: 100%; }
.postcard .card { height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 22px; }
.postcard__cover { display: block; aspect-ratio: 16 / 9; margin: -4px -6px 6px; background: var(--color-ph) center / cover no-repeat; mix-blend-mode: multiply; border-radius: 1px; }
.postcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-muted); }
.postcard__lang, .postcard__flag { font-size: 0.62rem; font-weight: 500; letter-spacing: .06em; padding: 1px 7px; border-radius: var(--radius-full); box-shadow: 0 0 0 1px var(--color-muted) inset; }
.postcard__flag { color: var(--marker); box-shadow: 0 0 0 1px var(--marker) inset; }
.postcard__title { font-size: 1.3rem; font-weight: 400; line-height: 1.2; letter-spacing: -0.015em; }
html[lang="th"] .postcard__title { line-height: 1.4; letter-spacing: 0; }
.postcard__excerpt { font-size: var(--text-sm); font-weight: 300; color: #444; }
.postcard__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.postcard__tags i { font-style: normal; font-size: 0.66rem; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-full); box-shadow: 0 0 0 1px var(--color-rule) inset; background: var(--color-bg); }
.postlist--home { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.writing__all { background: var(--color-bg); width: fit-content; }
@media (prefers-reduced-motion: reduce) { .postcard { transition: none; } }
.button--book { background: var(--marker); color: #fff; }
.button--book:hover { filter: brightness(1.1); }

/* Links under a case in the pinboard dialog */
.case__links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: var(--space-4); }
.case__links .button, .case__links .case__share { margin: 0; padding: 9px 18px; font-size: var(--text-xs); line-height: 1.2; }
