/* =========================================================
   Parinya Ardhan — profile
   Paper + ink palette, with a "thermal red" accent borrowed
   from two-colour ESC/POS receipt printers.
   ========================================================= */

:root {
  --bg: #f4f1ea;
  --bg-dots: rgba(23, 22, 15, 0.07);
  --surface: #fbfaf6;
  --surface-2: #ece8de;
  --ink: #17160f;
  --ink-2: #3b392f;
  --muted: #6b675b;
  --line: #dcd6c8;
  --accent: #d63f26;
  --accent-text: #b5321c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(214, 63, 38, 0.1);
  --ok: #1f9d55;

  --paper: #fffdf6;
  --paper-ink: #1b1a16;
  --paper-muted: #77736a;
  --printer: #24231f;
  --printer-2: #393731;

  --invert-bg: #17160f;
  --invert-ink: #f4f1ea;
  --invert-muted: #a8a397;
  --invert-line: #34322b;

  --shadow-sm: 0 1px 2px rgba(23, 22, 15, 0.06);
  --shadow: 0 1px 2px rgba(23, 22, 15, 0.06), 0 18px 40px -18px rgba(23, 22, 15, 0.28);

  --font-display: "Bricolage Grotesque", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "IBM Plex Sans Thai", ui-monospace, Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-lg: 26px;
  --gutter: 16px;
  --lh: 1.65;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11110f;
    --bg-dots: rgba(255, 250, 235, 0.05);
    --surface: #1a1a17;
    --surface-2: #23221f;
    --ink: #eeeae0;
    --ink-2: #d0cbbf;
    --muted: #9b9689;
    --line: #2f2e29;
    --accent: #ff6b4f;
    --accent-text: #ff8569;
    --accent-ink: #1a0d09;
    --accent-soft: rgba(255, 107, 79, 0.14);
    --ok: #3ccf7a;
    --paper: #f3efe3;
    --printer: #2c2b27;
    --printer-2: #3d3b35;
    --invert-bg: #1a1a17;
    --invert-ink: #eeeae0;
    --invert-muted: #9b9689;
    --invert-line: #2f2e29;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 22px 44px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

:root[data-theme="dark"] {
  --bg: #11110f;
  --bg-dots: rgba(255, 250, 235, 0.05);
  --surface: #1a1a17;
  --surface-2: #23221f;
  --ink: #eeeae0;
  --ink-2: #d0cbbf;
  --muted: #9b9689;
  --line: #2f2e29;
  --accent: #ff6b4f;
  --accent-text: #ff8569;
  --accent-ink: #1a0d09;
  --accent-soft: rgba(255, 107, 79, 0.14);
  --ok: #3ccf7a;
  --paper: #f3efe3;
  --printer: #2c2b27;
  --printer-2: #3d3b35;
  --invert-bg: #1a1a17;
  --invert-ink: #eeeae0;
  --invert-muted: #9b9689;
  --invert-line: #2f2e29;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 22px 44px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

html[lang="th"] { --lh: 1.8; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1.4px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: var(--lh);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
@media (min-width: 640px) { :root { --gutter: 28px; } }

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background-color 0.3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.nav__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.nav__links {
  display: none;
  gap: 4px;
  margin-left: auto;
}
.nav__links a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.93rem;
  color: var(--muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a[aria-current="true"] { color: var(--ink); }
.nav__links a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}

.nav__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
@media (min-width: 860px) {
  .nav__links { display: flex; }
  .nav__tools { margin-left: 12px; }
}

.lang {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }
.i-sun { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.btn svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover svg { transform: translateX(3px); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }

/* ---------- Hero ---------- */
.hero { padding-block: 40px 64px; }
@media (min-width: 960px) { .hero { padding-block: 72px 88px; } }

.hero__grid {
  display: grid;
  gap: 56px;
  align-items: center;
}
@media (min-width: 960px) {
  .hero__grid { grid-template-columns: 1.2fr 0.8fr; gap: 64px; }
}

.prompt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.6em;
}
.prompt__path { color: var(--ok); font-weight: 500; }
.prompt__sign { color: var(--muted); }
.prompt__typed { color: var(--ink); }
.caret {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  margin-left: -6px;
  background: var(--accent);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__name {
  font-size: clamp(3.4rem, 11vw, 8.4rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.045em;
  font-variation-settings: "opsz" 96;
}
.hero__name .line { display: block; }
.hero__name .line + .line { padding-left: 0.42em; }

.hero__role {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-top: 28px;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero__role-sep { color: var(--line); font-weight: 400; }
.hero__role-stack { font-size: 0.62em; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }

.hero__lede {
  max-width: 34em;
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--ink-2);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.hero__photo {
  position: relative;
  margin: 0;
  width: min(100%, 440px);
  justify-self: center;
}
/* the right margin leaves room for the 3D printer beside the photo */
@media (min-width: 960px) { .hero__photo { width: min(100%, 400px); justify-self: end; margin-right: 24px; } }

.hero__frame {
  position: relative;
}
.hero__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(14px, 14px);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  transition: transform 0.4s ease;
}
.hero__photo:hover .hero__frame::before { transform: translate(8px, 8px); }
.hero__frame img {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 34%;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

/* 3D hero (hero3d.js). The photo keeps its place as the layout box and the
   fallback; the canvas fades in over it once the scene has rendered. */
.hero__stage {
  position: absolute;
  z-index: 1;
  inset: -16% -22% -22% -25%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.hero__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  /* soften the canvas edge so a shadow never ends in a hard line */
  -webkit-mask: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent),
                linear-gradient(180deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in;
          mask: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent),
                linear-gradient(180deg, transparent, #000 3%, #000 97%, transparent);
          mask-composite: intersect;
}
.hero__photo.is-3d .hero__stage { opacity: 1; pointer-events: auto; }
.hero__photo.is-3d .hero__frame { opacity: 0; transition: opacity 0.6s ease; }
@media (max-width: 959px) { .hero__stage { inset: -15% -12% -15% -12%; } }
@media (max-width: 639px) { .hero__stage { inset: -15% -16px -15% -16px; } }

/* Receipt-stub caption on the photo */
.stub {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 26px;
  transform: rotate(-4deg);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22));
}
@media (min-width: 1100px) { .stub { left: -34px; } }

.stub__paper {
  display: grid;
  gap: 2px;
  min-width: 200px;
  padding: 14px 18px 22px;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 0.76rem;
  line-height: 1.45;
  --zz: 12px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zz) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zz) 100%;
}
.stub__paper strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.stub__label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--paper-muted);
}
.stub__meta { color: var(--paper-muted); }

.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ok);
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 24px;
  font-size: 0.9rem;
}
.avail {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 13px 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
}

/* ---------- Stats ---------- */
.stats__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 860px) { .stats__grid { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 22px 18px; background: var(--surface); }
@media (min-width: 860px) { .stat { padding: 28px 26px; } }
.stat__num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat__label { margin-top: 10px; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(72px, 10vw, 128px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.eyebrow__num {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  padding-inline: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-text);
  letter-spacing: 0.04em;
}

.section__title {
  max-width: 20ch;
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
html[lang="th"] .section__title,
html[lang="th"] .about__quote,
html[lang="th"] .contact__title { line-height: 1.3; letter-spacing: -0.01em; }

/* ---------- About ---------- */
.about {
  display: grid;
  gap: 40px;
}
@media (min-width: 960px) {
  .about { grid-template-columns: 1.15fr 1fr; gap: 72px; align-items: start; }
}

.about__quote {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.about__body { display: grid; gap: 18px; color: var(--ink-2); }

.facts {
  display: grid;
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
}
.facts div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 3px;
}
.facts dd { margin: 0; color: var(--ink); font-weight: 500; }

.edu {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  margin-top: 56px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 760px) {
  .edu { grid-template-columns: auto 1fr auto; gap: 28px; padding: 32px 36px; }
}
.edu__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.edu__icon svg { width: 26px; height: 26px; }
.edu__label { margin-bottom: 8px; }
.edu__school { font-size: clamp(1.3rem, 2.6vw, 1.7rem); letter-spacing: -0.02em; line-height: 1.2; }
.edu__degree { margin-top: 4px; font-weight: 600; color: var(--ink-2); }
.edu__desc { margin-top: 12px; max-width: 60ch; color: var(--muted); font-size: 0.97rem; }
.edu__years {
  grid-column: 2;
  font-size: 0.9rem;
  color: var(--muted);
}
@media (min-width: 760px) {
  .edu__years { grid-column: auto; align-self: start; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
}

/* ---------- Experience ---------- */
.jobs { margin-top: 48px; border-top: 1px solid var(--line); }

.job {
  display: grid;
  gap: 14px;
  padding-block: 34px;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 860px) {
  .job { grid-template-columns: 220px 1fr; gap: 48px; padding-block: 42px; }
}

.job__when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-size: 0.88rem;
  color: var(--muted);
}
@media (min-width: 860px) {
  .job__when { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 8px; }
}

.job__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 600;
}
.job__badge .live-dot,
.job__badge .live-dot::after { background: var(--accent); }

.job__dur {
  font-size: 0.78rem;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.job__company {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  transition: color 0.2s ease;
}
.job:hover .job__company { color: var(--accent-text); }
.job__role { margin-top: 6px; font-weight: 600; color: var(--ink-2); }

.job__points {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  max-width: 68ch;
  color: var(--ink-2);
}
.job__points li {
  position: relative;
  padding-left: 22px;
}
.job__points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 9px;
  height: 1.5px;
  background: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.tags li {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--surface);
}

/* ---------- Featured ---------- */
.feature {
  display: grid;
  gap: 40px;
  padding: 28px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 640px) { .feature { padding: 40px; } }
@media (min-width: 1000px) {
  .feature { grid-template-columns: 0.95fr 1.05fr; gap: 56px; padding: 56px; align-items: center; }
}

.feature__text .role { margin-bottom: 18px; }
.feature__title { font-size: clamp(1.8rem, 3.6vw, 2.7rem); max-width: 18ch; }
.feature__text > p { margin-top: 20px; color: var(--ink-2); max-width: 52ch; }

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 28px 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.specs div { padding: 14px 16px; background: var(--surface); }
.specs dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.specs dd { margin: 4px 0 0; font-weight: 600; font-size: 0.95rem; }

.feature__diagram {
  padding: 18px;
  border-radius: 20px;
  background: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1.4px);
  background-size: 18px 18px;
  border: 1px solid var(--line);
}
.dg { width: 100%; height: auto; stroke: none; }
.dg--wide { display: none; }
@media (min-width: 640px) {
  .dg--wide { display: block; }
  .dg--tall { display: none; }
}

.dg .flow {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-dasharray: 5 7;
  animation: flow 1.1s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -24; } }

.dg .node rect {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1.5;
}
.dg text { stroke: none; fill: var(--ink); font-family: var(--font-body); }
.dg .t { font-size: 15px; font-weight: 600; font-family: var(--font-display); }
html[lang="th"] .dg .t { font-family: var(--font-body); }
.dg .s { font-size: 12px; fill: var(--muted); font-family: var(--font-mono); }
.dg .node--accent rect { fill: var(--accent); stroke: var(--accent); }
.dg .node--accent text { fill: var(--accent-ink); }
.dg .node--accent .s { fill: var(--accent-ink); opacity: 0.85; }
.dg .s--note { fill: var(--muted); }
.dg .lan { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 5; opacity: 0.75; }
.dg .lan-label { font-size: 11px; fill: var(--muted); font-family: var(--font-mono); letter-spacing: 0.04em; }
.dg .flow--back { stroke: var(--accent); }
.dg .s--back { fill: var(--accent-text); }

.fixes {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
@media (min-width: 1000px) { .fixes { grid-column: 1 / -1; } }
.fixes__title {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.fixes__list { margin-top: 10px; }
.fix {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 4px 0;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}
.fix:last-child { border-bottom: 0; padding-bottom: 0; }
.fix__no { font-size: 0.8rem; color: var(--accent-text); padding-top: 4px; }
.fix__problem { font-weight: 600; color: var(--ink); }
.fix__solution { grid-column: 2; color: var(--ink-2); }
@media (min-width: 760px) {
  .fix { grid-template-columns: 44px minmax(0, 0.7fr) minmax(0, 1.6fr); gap: 0 28px; }
  .fix__solution { grid-column: 3; }
}

/* ---------- Role badges ---------- */
.role {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.5;
}
.role--built { background: var(--accent); color: var(--accent-ink); }
.role--lead { background: var(--ink); color: var(--bg); }
.role--took { border-color: var(--ink); color: var(--ink); }
.role--proto { border: 1px dashed var(--muted); color: var(--ink-2); }
.role--maint { background: var(--surface-2); color: var(--ink-2); }

/* ---------- Projects ---------- */
.projects { margin-top: clamp(56px, 8vw, 96px); }
.projects__title {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.projects__grid {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}
@media (min-width: 860px) {
  .projects__grid { grid-template-columns: 1fr 1fr; }
  .project--wide { grid-column: 1 / -1; }
}
.project,
.project__col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project {
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
@media (min-width: 640px) { .project { padding: 28px; } }
.project:hover { transform: translateY(-3px); border-color: var(--ink); }
@media (min-width: 860px) {
  .project--wide { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px 56px; align-items: center; }
}
.project__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.project__kind { font-size: 0.74rem; color: var(--muted); letter-spacing: 0.04em; }
.project h3 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); letter-spacing: -0.02em; line-height: 1.25; }
.project__desc { color: var(--ink-2); }
.project .job__points { margin-top: 0; }
.project .tags { margin-top: auto; padding-top: 6px; }

/* ---------- Services ---------- */
.services__grid {
  display: grid;
  gap: 14px;
  margin-top: 40px;
}
@media (min-width: 640px) { .services__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .services__grid { grid-template-columns: repeat(4, 1fr); } }
.service {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.service:hover { transform: translateY(-3px); border-color: var(--ink); }
.service h3 { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.3; }
.service p { font-size: 0.95rem; color: var(--muted); line-height: 1.6; }
.services__cta { margin-top: 32px; }

/* ---------- Skills + Printer ---------- */
.skills {
  display: grid;
  gap: 56px;
}
@media (min-width: 960px) {
  .skills { grid-template-columns: 1fr minmax(360px, 420px); gap: 80px; align-items: start; }
}

.section__lede { margin-top: 20px; max-width: 52ch; color: var(--ink-2); }

.focus {
  display: grid;
  gap: 12px;
  margin-top: 36px;
}
/* two columns only where the text column is wide enough (it shares the row with the printer from 960px) */
@media (min-width: 640px) and (max-width: 959px), (min-width: 1180px) {
  .focus { grid-template-columns: 1fr 1fr; }
}
.focus li {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.focus li:hover { transform: translateY(-3px); border-color: var(--ink); }
.focus__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
}
.focus__icon svg { width: 21px; height: 21px; }
.focus h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
.focus p { margin-top: 2px; font-size: 0.9rem; color: var(--muted); line-height: 1.5; }

.printer {
  position: relative;
  width: 100%;
  max-width: 420px;
  justify-self: center;
}

.printer__body {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding-inline: 18px;
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, var(--printer-2), var(--printer));
  color: #cfcabd;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.printer__led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ccf7a;
  box-shadow: 0 0 10px #3ccf7a;
}
.printer.is-printing .printer__led { animation: led 0.25s steps(1) infinite; background: #ffb547; box-shadow: 0 0 10px #ffb547; }
.printer.is-done .printer__led { animation: none; background: #3ccf7a; box-shadow: 0 0 10px #3ccf7a; }
@keyframes led { 50% { opacity: 0.2; } }
.printer__brand { font-size: 0.68rem; letter-spacing: 0.16em; color: #8f8a7e; }
.printer__btn {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid #4a4840;
  border-radius: 999px;
  background: #1a1916;
  color: #e9e4d6;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.printer__btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.printer__slot {
  position: relative;
  z-index: 3;
  height: 8px;
  margin: -4px 22px 0;
  border-radius: 0 0 6px 6px;
  background: #0d0c0a;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6);
}

.printer__feed {
  margin: -4px 34px 0;
  padding-bottom: 28px;
  overflow: hidden;
}

.receipt-shadow { filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.16)); }

.receipt {
  --zz: 14px;
  padding: 26px 22px 34px;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 0.78rem;
  line-height: 1.55;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zz) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zz) 100%;
}

.js .printer .receipt { transform: translateY(-101%); }
.js .printer.is-printing .receipt,
.js .printer.is-done .receipt { animation: feed 3s steps(32, end) forwards; }
@keyframes feed {
  from { transform: translateY(-101%); }
  to { transform: translateY(0); }
}

.receipt__head { text-align: center; }
.receipt__title { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.08em; }
.receipt__head p:not(.receipt__title) { color: var(--paper-muted); font-size: 0.72rem; letter-spacing: 0.06em; }

.receipt__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.receipt__meta { margin-top: 16px; color: var(--paper-muted); font-size: 0.72rem; }

.receipt__rule {
  margin: 12px 0;
  border: 0;
  border-top: 1.5px dashed color-mix(in srgb, var(--paper-ink) 45%, transparent);
}

.receipt__group + .receipt__group { margin-top: 12px; }
.receipt__cat { font-weight: 600; letter-spacing: 0.06em; }
.receipt__cat .qty { font-weight: 500; color: #c2361f; }
.receipt__items {
  display: flex;
  flex-wrap: wrap;
  padding-left: 12px;
  color: #3e3c35;
}
.receipt__items li { white-space: nowrap; }
.receipt__items li:not(:last-child)::after { content: "·"; padding-inline: 6px; color: var(--paper-muted); }

.receipt__total { font-size: 0.92rem; font-weight: 600; }

.barcode { height: 44px; margin-top: 4px; }
.barcode svg { width: 100%; height: 100%; }
.barcode rect { fill: var(--paper-ink); stroke: none; }

.receipt__thanks {
  margin-top: 10px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--paper-muted);
}

/* ---------- Contact ---------- */
.contact {
  padding-block: clamp(80px, 11vw, 140px);
  background: var(--invert-bg);
  color: var(--invert-ink);
  border-top: 1px solid var(--invert-line);
}
.contact .eyebrow { color: var(--invert-muted); }
.contact .eyebrow__num { border-color: var(--invert-line); color: var(--accent); }

.contact__title {
  max-width: 16ch;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.contact__lede { margin-top: 22px; max-width: 42ch; color: var(--invert-muted); font-size: 1.08rem; }

.contact__grid {
  display: grid;
  gap: 14px;
  margin-top: 48px;
}
@media (min-width: 860px) { .contact__grid { grid-template-columns: 1.4fr 1fr 1fr; } }

.ccard {
  position: relative;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 22px;
  border: 1px solid var(--invert-line);
  border-radius: var(--radius);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.ccard:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ccard__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--invert-ink) 9%, transparent);
}
.ccard__icon svg { width: 20px; height: 20px; }
.ccard__label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--invert-muted); }
.ccard__value {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
a.ccard__value::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
a.ccard__value:hover { color: var(--accent); }
.ccard__copy {
  position: absolute;
  z-index: 1;
  top: 22px;
  right: 22px;
  padding: 5px 12px;
  border: 1px solid var(--invert-line);
  border-radius: 999px;
  background: var(--invert-bg);
  color: var(--invert-ink);
  font-size: 0.72rem;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.ccard__copy:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Footer ---------- */
.footer {
  background: var(--invert-bg);
  color: var(--invert-muted);
  border-top: 1px solid var(--invert-line);
  font-size: 0.88rem;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-block: 26px;
}
.footer__built { flex: 1 1 260px; }
.footer__views {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 13px 4px 11px;
  border: 1px solid var(--invert-line);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--invert-ink);
}
.footer__views[hidden] { display: none; }
.footer__views svg { width: 15px; height: 15px; color: var(--accent); }
.footer__views strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.footer__views span:empty { display: none; }
.footer__sep { color: var(--invert-muted); }
.footer__top { text-decoration: none; color: var(--invert-ink); font-size: 0.8rem; }
.footer__top:hover { color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Hero entrance */
.js .hero__text > *,
.js .hero__photo {
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.js .hero__text > :nth-child(2) { animation-delay: 0.08s; }
.js .hero__text > :nth-child(3) { animation-delay: 0.16s; }
.js .hero__text > :nth-child(4) { animation-delay: 0.22s; }
.js .hero__text > :nth-child(5) { animation-delay: 0.28s; }
.js .hero__text > :nth-child(6) { animation-delay: 0.34s; }
.js .hero__photo { animation-delay: 0.18s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .js .printer .receipt { transform: none; animation: none !important; }
  .caret { animation: none; }
}
