/* phai-studio.monrak.net — one style for the whole page, after desktopserver.monrak.net and monrak.net.
   Tokens first; every card on the page is the same .card, with the same hover (spotlight, tilt, lift),
   the same running light on its border, and the same fade-in. Only the tokens change colour. */

:root {
    --green: #0b6a4a;          /* the brand: buttons, accents, the running light */
    --green-rgb: 11 106 74;
    --green-dark: #084a34;
    --green-soft: #e3f3eb;
    --ink: #0f1f19;            /* headings */
    --text: #24352e;
    --muted: #5d6f67;
    --line: #e2ebe6;
    --surface: #ffffff;
    --tint: #f5faf7;           /* alternate sections */
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 16px 36px rgb(var(--green-rgb) / .12), 0 2px 6px rgb(0 0 0 / .04);
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --sans: "IBM Plex Sans Thai", "Leelawadee UI", "Segoe UI", system-ui, sans-serif;
    --wrap: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--surface); color: var(--text); font: 1rem/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: .88em; background: var(--green-soft); color: var(--green-dark); padding: 1px 6px; border-radius: 6px; }
pre { margin: 12px 0 0; padding: 14px 16px; overflow-x: auto; background: #0f1f19; color: #d6efe3; border-radius: var(--radius-sm); }
pre code { background: none; color: inherit; padding: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--tint); }
::-webkit-scrollbar-thumb { background: #b9d8c8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

/* texture: a faint grid behind everything */
#grid-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: linear-gradient(to right, rgb(15 31 25 / .045) 1px, transparent 1px), linear-gradient(to bottom, rgb(15 31 25 / .045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 25%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 25%, #000 40%, transparent 100%); }
main, .foot { position: relative; z-index: 2; }

/* the small mono labels above every heading */
.label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; font: 500 11px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--green); }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: rgb(255 255 255 / .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand small { font: 500 9px/1 var(--mono); letter-spacing: .24em; color: var(--muted); }
.brand b { font-size: 1.05rem; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.nav a:hover { color: var(--green); }
.nav .lang { display: inline-flex; align-items: center; gap: 4px; }
.nav .cta { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 600; }
.nav .cta:hover { background: var(--green); color: #fff; }
@media (max-width: 860px) { .nav .hide-sm { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; text-decoration: none; transition: background .2s, border-color .2s, color .2s, transform .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* hero */
.hero { padding: 96px 0 56px; }
.hero-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: center; }
.hero h1 { margin: 6px 0 18px; color: var(--ink); font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.18; font-weight: 700; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: var(--green); }
.hero .lead { margin: 0 0 28px; max-width: 40em; color: var(--muted); font-size: 1.08rem; }
.hero-art { display: flex; justify-content: center; }
.hero-art img { width: min(300px, 70vw); height: auto; filter: drop-shadow(0 22px 44px rgb(var(--green-rgb) / .28)); animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.stats { display: flex; flex-wrap: wrap; gap: 0; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.stats div { padding: 0 28px; border-left: 1px solid var(--line); }
.stats div:first-child { padding-left: 0; border-left: 0; }
.stats small { display: block; font: 500 10px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.stats b { display: block; font: 600 1.6rem/1.3 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
    .hero { padding: 48px 0 32px; }
    .hero-row { grid-template-columns: 1fr; }
    .hero-art { order: -1; }
    .hero-art img { width: 160px; }
    .stats div { padding: 0 16px; }
}

/* sections */
.section { position: relative; padding: 80px 0; border-top: 1px solid var(--line); }
.section.tint { background: rgb(245 250 247 / .8); }
.section h2 { margin: 0 0 10px; color: var(--ink); font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.25; font-weight: 700; }
.section .sub { margin: 0 0 32px; max-width: 46em; color: var(--muted); font-size: 1.04rem; }
.mt { margin-top: 24px; }
.note { margin: 10px 0 0; color: var(--muted); font-size: .94rem; }
.note i { color: var(--green); }
@media (max-width: 860px) { .section { padding: 56px 0; } }

/* grids */
.grid { display: grid; gap: 16px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 960px) { .grid.g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.g3, .grid.g2 { grid-template-columns: 1fr; } }

/* THE card: every box on the page */
.card { position: relative; display: block; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgb(255 255 255 / .78); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--text); text-decoration: none; isolation: isolate; }
.card .icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-size: 1.4rem; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background .3s, color .3s, box-shadow .3s; }
.card h3 { margin: 0 0 6px; color: var(--ink); font-size: 1.05rem; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card.row { display: flex; gap: 14px; align-items: flex-start; }
.card.row .icon { flex: none; margin-bottom: 0; }
.card.main { border-color: rgb(var(--green-rgb) / .4); background: linear-gradient(150deg, rgb(227 243 235 / .9), rgb(255 255 255 / .8) 65%); }

/* the running light around the border */
@property --beam { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.card::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; padding: 1px;
    background: conic-gradient(from var(--beam), transparent 0deg, transparent 300deg, rgb(var(--green-rgb) / .4) 335deg, rgb(var(--green-rgb) / .95) 352deg, transparent 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
    animation: beam 6s linear infinite; }
.card:nth-child(3n+2)::after { animation-delay: -2s; }
.card:nth-child(3n)::after { animation-delay: -4s; }
@keyframes beam { to { --beam: 360deg; } }

/* hover: a spotlight under the pointer, a slight tilt, a lift; the icon turns green */
.card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(var(--green-rgb) / .1), transparent 62%); }
.card { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, opacity .7s ease-out; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.card:hover { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); box-shadow: var(--shadow); border-color: rgb(var(--green-rgb) / .3); }
.card:hover::before { opacity: 1; }
.card:hover::after { animation-duration: 2.5s; }
.card:hover .icon { transform: scale(1.1) rotate(-6deg); background: var(--green); color: #fff; box-shadow: 0 6px 16px rgb(var(--green-rgb) / .3); }

/* fade in once, then drift a little with the scrollbar */
.reveal { opacity: 0; translate: 0 var(--drift, 18px); }
.reveal.shown { opacity: 1; }
.glide { translate: 0 var(--drift, 0px); will-change: translate; }

@media (hover: none), (prefers-reduced-motion: reduce) { .card, .card:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { .card::after { animation: none; opacity: 0; } .hero-art img { animation: none; } .reveal { opacity: 1; translate: none; } }

/* lessons: numbered */
.lesson b { display: block; margin-bottom: 4px; font: 600 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--green); }

/* gallery: a slider of real screens; a click opens it large */
.gallery { display: grid; grid-template-columns: 1fr; gap: 14px; }
.slider { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 20px 50px rgb(var(--green-rgb) / .12); }
.slides { display: flex; transition: transform .6s ease; }
.slide { flex: 0 0 100%; display: block; cursor: zoom-in; }
.slide img { display: block; width: 100%; height: auto; aspect-ratio: 1432 / 969; object-fit: contain; background: #f3f6f4; }
.slider .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .92); color: var(--green); font-size: 1.3rem; cursor: pointer; box-shadow: 0 2px 10px rgb(0 0 0 / .15); opacity: 0; transition: opacity .2s, background .2s, color .2s; }
.slider:hover .nav-btn, .slider .nav-btn:focus-visible { opacity: 1; }
.slider .nav-btn:hover { background: var(--green); color: #fff; }
.sl-prev { left: 12px; }
.sl-next { right: 12px; }
.zoom { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgb(15 31 25 / .7); color: #fff; font-size: .82rem; pointer-events: none; }
.caption { margin: 0; text-align: center; color: var(--muted); font-size: .95rem; }
.caption b { color: var(--ink); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.thumbs button { flex: 0 0 auto; width: 120px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; opacity: .6; transition: opacity .2s, border-color .2s, transform .2s; }
.thumbs button img { display: block; width: 100%; height: auto; aspect-ratio: 1432 / 969; object-fit: cover; object-position: top left; border-radius: 6px; }
.thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.thumbs button.on { opacity: 1; border-color: var(--green); }
@media (hover: none) { .slider .nav-btn { opacity: 1; } }

.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 64px 16px; background: rgb(8 20 15 / .94); }
.lightbox[hidden] { display: none; }
.lb-stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
.lb-stage img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }
.lb-caption { margin: 10px 0 0; color: #fff; text-align: center; font-size: .95rem; }
.lightbox button { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .14); color: #fff; font-size: 1.5rem; cursor: pointer; }
.lightbox button:hover { background: var(--green); }
.lb-close { top: 10px; right: 12px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) { .lightbox { padding: 56px 8px 12px; } }

/* install steps */
.step .num { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 12px; border-radius: 50%; background: var(--green); color: #fff; font: 600 .9rem/1 var(--mono); }

/* contacts */
.contacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.contact { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.contact .icon { margin: 0; border-radius: 50%; background: var(--brand); color: #fff; }
.contact:hover .icon { background: var(--brand); }
.contact b { display: block; color: var(--ink); }
.contact small { color: var(--muted); overflow-wrap: anywhere; }
.contact.line { --brand: #06c755; }
.contact.fb { --brand: #1877f2; }
.contact.mail { --brand: #ea4335; }
@media (max-width: 860px) { .contacts { grid-template-columns: 1fr; } }

/* download */
.file { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.file h3 { margin-bottom: 2px; }
.file details { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.file .sha { word-break: break-all; }

/* footer */
.foot { padding: 56px 0 72px; border-top: 1px solid var(--line); background: rgb(245 250 247 / .85); }
.foot blockquote { margin: 18px 0 28px; padding: 4px 0 4px 18px; border-left: 3px solid var(--green); color: var(--muted); font-style: italic; }
.foot h3 { margin: 0 0 14px; color: var(--ink); font-size: 1rem; }
.foot .copy { margin: 28px 0 0; color: var(--muted); font-size: .9rem; }
.family .card { padding: 16px 18px; }
.family .card b { display: block; color: var(--green); }
.family .card span { color: var(--muted); font-size: .9rem; }

/* where you are on the page, bottom left */
#hud { position: fixed; left: 16px; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgb(255 255 255 / .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font: 10px/1.4 var(--mono); letter-spacing: .12em; color: var(--muted); pointer-events: none; }
#hud i { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
#hud span:first-of-type { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 3ch; }
#hud b { font-weight: 400; color: var(--line); }
@media (max-width: 640px) { #hud { display: none; } }

/* Thai: lines break between phrases only (assets/thai-wrap.js), no lone word on the last line. */
.nb { white-space: nowrap; }
p, li, h1, h2, h3, figcaption, blockquote, small, span { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
