/*
Theme Name: NiXTORYA
Theme URI: https://nxaicoding.com/
Author: NiXTORYA UNiVERSE
Author URI: https://nxaicoding.com/
Description: Custom block theme for NiXTORYA UNiVERSE. Soft pastel sci-fi space, liquid glass panels, bilingual English/Thai headings. AI-born. Human-used.
Version: 1.0.2
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nixtorya
*/

/* Layout: one calm column floating in soft space; glass panels drift over a starfield, one planet anchors the hero. */
:root {
  --nx-bg: #f5f4f9;
  --nx-bg-2: #eceef7;
  --nx-ink: #2c2638;
  --nx-ink-soft: #6c6779;
  --nx-accent: #f6a5c8;
  --nx-accent-ink: #b24c80;
  --nx-accent-2: #b8c2f2;
  --nx-glass: rgba(255, 255, 255, 0.42);
  --nx-glass-hi: rgba(255, 255, 255, 0.75);
  --nx-glass-edge: rgba(255, 255, 255, 0.9);
  --nx-glass-shadow: rgba(90, 80, 130, 0.18);
  --nx-line: rgba(70, 60, 100, 0.13);
  --nx-star: 110, 105, 150;
  --nx-planet-a: #f4eef8;
  --nx-planet-b: #efc3da;
  --nx-planet-c: #a8b3ee;
  --nx-live: #3fbf8a;

  --nx-display: "Unbounded", "Trebuchet MS", system-ui, sans-serif;
  --nx-body: "Kanit", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --nx-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --nx-r-lg: 32px;
  --nx-r-md: 22px;
  --nx-wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nx-bg: #0f0e18; --nx-bg-2: #161727; --nx-ink: #f1eff7; --nx-ink-soft: #aaa6bb;
    --nx-accent: #f3a9cb; --nx-accent-ink: #f6b8d4; --nx-accent-2: #8f9de0;
    --nx-glass: rgba(230, 230, 255, 0.05); --nx-glass-hi: rgba(235, 235, 255, 0.11);
    --nx-glass-edge: rgba(225, 225, 250, 0.22); --nx-glass-shadow: rgba(0, 0, 0, 0.55);
    --nx-line: rgba(220, 220, 245, 0.12); --nx-star: 236, 236, 250;
    --nx-planet-a: #ece6f6; --nx-planet-b: #c993b5; --nx-planet-c: #4f5aa8;
    --nx-live: #5fdba7;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--nx-bg);
  color: var(--nx-ink);
  font-family: var(--nx-body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--nx-bg);
}
a { color: var(--nx-accent-ink); }
img { max-width: 100%; height: auto; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; color: var(--nx-ink); }

/* Space */
#nx-stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.nx-nebula {
  position: fixed; inset: -10%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 32% at 15% 10%, color-mix(in srgb, var(--nx-accent) 18%, transparent), transparent 70%),
    radial-gradient(40% 35% at 90% 30%, color-mix(in srgb, var(--nx-accent-2) 34%, transparent), transparent 70%),
    radial-gradient(45% 40% at 60% 100%, color-mix(in srgb, var(--nx-accent-2) 22%, transparent), transparent 70%),
    linear-gradient(180deg, var(--nx-bg), var(--nx-bg-2));
  filter: blur(10px);
}
.wp-site-blocks { position: relative; z-index: 1; }
.wrap {
  max-width: var(--nx-wrap); margin-left: auto !important; margin-right: auto !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Liquid glass */
.glass, .is-style-nx-glass {
  position: relative;
  background: linear-gradient(140deg, var(--nx-glass-hi), var(--nx-glass) 55%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--nx-glass-edge);
  box-shadow:
    inset 0 1px 0 var(--nx-glass-edge),
    inset 0 -18px 40px -32px var(--nx-accent-2),
    0 30px 60px -30px var(--nx-glass-shadow);
  border-radius: var(--nx-r-lg);
  isolation: isolate;
}
.glass::after, .is-style-nx-glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(260px circle at var(--mx, 20%) var(--my, 0%), var(--nx-glass-hi), transparent 70%);
  opacity: .9;
}
.is-style-nx-glass { padding: 32px; }

/* Bilingual: English leads, Thai whispers underneath. Wrap the Thai in <span class="th">. */
.bi { display: flex; flex-direction: column; line-height: 1.1; }
.th { display: block; font-family: var(--nx-body); font-weight: 400; font-size: .62em; letter-spacing: .02em; color: var(--nx-ink-soft); margin-top: .35em; }
/* In running text the Thai line sits just under the English, a little smaller */
p .th, li .th { font-size: .88em; letter-spacing: 0; margin-top: .1em; }
.notes li .th { padding-left: 0; }
.wp-block-list.notes { gap: 10px; }

/* Header */
.wp-site-blocks > header {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 14px); z-index: 20;
}
.admin-bar .wp-site-blocks > header { top: calc(env(safe-area-inset-top, 0px) + 46px); }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > header { top: calc(env(safe-area-inset-top, 0px) + 60px); } }
.nx-header { padding-top: 14px; }
.nx-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px 12px 22px; border-radius: 999px;
}
.nx-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--nx-ink); }
.nx-brand-mark {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #fff, var(--nx-planet-a) 30%, var(--nx-planet-b) 65%, var(--nx-planet-c));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--nx-accent-2) 22%, transparent), 0 0 18px color-mix(in srgb, var(--nx-accent) 60%, transparent);
}
.nx-brand-name { font-family: var(--nx-display); font-weight: 500; font-size: 15px; letter-spacing: .04em; white-space: nowrap; }
.nx-menu { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nx-menu a {
  display: inline-flex; flex-direction: column; align-items: center; text-decoration: none;
  color: var(--nx-ink); padding: 8px 18px; border-radius: 999px;
  font-family: var(--nx-display); font-weight: 500; font-size: 19px; line-height: 1.05; letter-spacing: .01em;
  transition: background .25s ease;
}
.nx-menu a .th { font-size: 11.5px; margin-top: 4px; letter-spacing: .04em; }
.nx-menu a:hover, .nx-menu a[aria-current="true"] { background: color-mix(in srgb, var(--nx-ink) 7%, transparent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--nx-accent-ink); outline-offset: 3px; }

/* Buttons */
.wp-block-buttons.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.wp-block-button .wp-block-button__link {
  display: inline-flex; flex-direction: column; justify-content: center; text-align: left; text-decoration: none;
  padding: 14px 26px; border-radius: 999px; color: var(--nx-ink); background: var(--nx-glass);
  border: 1px solid var(--nx-glass-edge);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  font-family: var(--nx-display); font-weight: 500; font-size: 16px; line-height: 1.1;
  transition: transform .25s ease;
}
.wp-block-button .wp-block-button__link .th { font-size: 12px; color: inherit; opacity: .75; margin-top: 4px; }
.wp-block-button.is-style-nx-primary .wp-block-button__link {
  background: linear-gradient(140deg, color-mix(in srgb, var(--nx-accent) 85%, #fff), var(--nx-accent));
  color: #3b1630; border-color: color-mix(in srgb, #fff 60%, var(--nx-accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 16px 36px -14px var(--nx-accent);
}
.wp-block-button .wp-block-button__link:hover { transform: translateY(-2px); }

/* Hero */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 40px; padding-block: 72px 56px; }
.hero > * { min-width: 0; }
.eyebrow { font-family: var(--nx-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--nx-accent-ink); }
.hero h1 {
  font-family: var(--nx-display); font-weight: 700; margin-top: 18px;
  font-size: clamp(42px, 7.4vw, 92px); line-height: .95; letter-spacing: -.02em; text-wrap: balance;
}
.hero h1 .glow {
  display: block; font-weight: 300;
  background: linear-gradient(100deg, var(--nx-accent-ink), var(--nx-accent) 35%, var(--nx-accent-2) 75%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.slogan-en { font-family: var(--nx-display); font-weight: 500; font-size: clamp(19px, 2.2vw, 25px); letter-spacing: .01em; margin-top: 22px !important; }
.slogan-th { font-size: 17px; color: var(--nx-ink-soft); margin-top: 4px !important; }
.hero-lede { font-size: 18px; max-width: 34em; margin-top: 14px !important; }

/* Planet */
.orbit { position: relative; aspect-ratio: 1; max-width: 100%; width: min(440px, 100%); margin-inline: auto; }
.planet {
  position: absolute; inset: 14%; border-radius: 50%; overflow: hidden;
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,.95), transparent 22%),
    radial-gradient(circle at 38% 34%, var(--nx-planet-a), var(--nx-planet-b) 55%, var(--nx-planet-c) 100%);
  box-shadow: inset -30px -40px 80px -20px var(--nx-planet-c), 0 0 90px -20px var(--nx-accent-2);
}
.planet::before {
  content: ""; position: absolute; inset: -20%;
  background: repeating-linear-gradient(170deg, transparent 0 22px, rgba(255,255,255,.14) 22px 30px);
  animation: nx-drift 40s linear infinite;
}
.ring {
  position: absolute; inset: 40% -4%; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--nx-glass-edge) 80%, transparent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--nx-accent-2) 14%, transparent), 0 0 30px color-mix(in srgb, var(--nx-accent-2) 70%, transparent);
  transform: rotate(-16deg);
}
.moon {
  position: absolute; width: 9%; aspect-ratio: 1; border-radius: 50%; top: 8%; right: 12%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--nx-accent-2));
  box-shadow: 0 0 20px var(--nx-accent-2);
  animation: nx-bob 7s ease-in-out infinite;
}
.signal { position: absolute; left: -2%; bottom: 4%; padding: 14px 18px; border-radius: var(--nx-r-md); display: grid; gap: 2px; max-width: 78%; }
.signal .k { font-family: var(--nx-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--nx-accent-ink); display: flex; align-items: center; gap: 8px; }
.signal .k::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--nx-live); box-shadow: 0 0 10px var(--nx-live); animation: nx-pulse 2.4s ease-in-out infinite; }
.signal .v { font-family: var(--nx-display); font-weight: 500; font-size: 15px; }
.signal .t { font-size: 12.5px; color: var(--nx-ink-soft); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px; }
.stat { padding: 26px 28px; display: grid; gap: 4px; align-content: start; }
.stat + .stat { border-left: 1px solid var(--nx-line); }
.stat .n { font-family: var(--nx-display); font-weight: 300; font-size: clamp(40px, 5vw, 58px); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .n sup { font-size: .4em; color: var(--nx-accent-ink); font-weight: 500; }
.stat .l { font-family: var(--nx-display); font-size: 15px; font-weight: 500; margin-top: 10px; }
.stat .th { font-size: 13px; margin-top: 0; }
.wp-block-list.notes { list-style: none; margin: 16px 0 0; padding: 0 8px; display: grid; gap: 4px; font-size: 13px; color: var(--nx-ink-soft); }
.notes strong { color: var(--nx-accent-ink); font-weight: 600; }

/* Sections */
section[id] { scroll-margin-top: 130px; }
.section { padding-block: 96px 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 36px; }
.sec-head h2 { font-family: var(--nx-display); font-weight: 700; font-size: clamp(32px, 4.6vw, 54px); line-height: 1; letter-spacing: -.015em; margin-top: 10px; }
.sec-head h2 .th { font-size: max(15px, .34em); }
.sec-head > p { max-width: 30em; color: var(--nx-ink-soft); }

/* Services */
.services { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 20px; }
.svc { padding: 30px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.svc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag { font-family: var(--nx-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--nx-line); color: var(--nx-ink-soft); }
.tag.live { color: var(--nx-accent-ink); border-color: color-mix(in srgb, var(--nx-accent) 60%, transparent); background: color-mix(in srgb, var(--nx-accent) 16%, transparent); }
.svc h3 { font-family: var(--nx-display); font-weight: 500; font-size: 26px; line-height: 1.1; margin-top: 6px; }
.svc h3 .th { font-size: 14px; }
.svc .readout { font-family: var(--nx-mono); font-size: 12px; padding: 6px 12px; border-radius: 8px; align-self: flex-start; background: color-mix(in srgb, var(--nx-accent-2) 16%, transparent); }
.svc .fine { font-size: 12.5px; color: var(--nx-ink-soft); border-top: 1px solid var(--nx-line); padding-top: 12px; margin-top: auto; }
.svc .wp-block-buttons { margin: 0; }
.svc.soon { background: transparent; border-style: dashed; box-shadow: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.svc.soon::after { display: none; }
.svc.soon h3 { color: var(--nx-ink-soft); }
.ico { width: 56px; height: 56px; border-radius: 50%; border: 1px dashed var(--nx-accent-ink); position: relative; margin-top: 8px; }
.ico::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--nx-accent); top: -5px; left: calc(50% - 5px); transform-origin: 5px 33px; animation: nx-spin 6s linear infinite; }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px; }
.pr { padding: 30px 28px; display: grid; gap: 10px; align-content: start; }
.pr + .pr { border-left: 1px solid var(--nx-line); }
.pr .code { font-family: var(--nx-mono); font-size: 12px; color: var(--nx-accent-ink); letter-spacing: .1em; }
.pr h3 { font-family: var(--nx-display); font-weight: 500; font-size: 21px; line-height: 1.15; }
.pr h3 .th { font-size: 13px; }
.pr p:not(.code) { color: var(--nx-ink-soft); font-size: 15px; }

/* Contact */
.contact { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; padding: 44px; align-items: center; }
.contact > * { min-width: 0; }
.contact h2 { font-family: var(--nx-display); font-weight: 700; font-size: clamp(30px, 4vw, 46px); line-height: 1; margin-top: 10px; }
.contact h2 .th { font-size: max(15px, .34em); }
.contact-copy > p:last-child { color: var(--nx-ink-soft); margin-top: 16px; max-width: 30em; }
.channels { display: grid; gap: 12px; }
.chan { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--nx-r-md); background: var(--nx-glass); border: 1px solid var(--nx-line); }
.chan .k { font-family: var(--nx-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--nx-ink-soft); }
.chan .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chan .v { font-family: var(--nx-display); font-size: 17px; font-weight: 500; overflow-wrap: anywhere; color: var(--nx-ink); text-decoration: none; }
.chan a.v:hover { color: var(--nx-accent-ink); }
.nx-copy { font: 500 13px var(--nx-body); color: var(--nx-ink); background: color-mix(in srgb, var(--nx-ink) 7%, transparent); border: 1px solid var(--nx-glass-edge); border-radius: 999px; padding: 6px 14px; cursor: pointer; }

/* Footer */
.nx-footer { padding-block: 72px 40px; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--nx-ink-soft); border-top: 1px solid var(--nx-line); padding-top: 22px; }
.foot .mono { font-family: var(--nx-mono); letter-spacing: .08em; }

/* Regular pages and posts */
.nx-page { padding-block: 56px 0; }
.nx-article { padding: 44px; max-width: 860px; margin-inline: auto; }
.nx-article .wp-block-post-title { font-family: var(--nx-display); font-weight: 700; font-size: clamp(30px, 4.4vw, 48px); line-height: 1.05; text-wrap: balance; }
.nx-article .wp-block-post-date { font-family: var(--nx-mono); font-size: 12px; letter-spacing: .12em; color: var(--nx-ink-soft); margin-top: 10px; }
.nx-prose { margin-top: 28px; }
.nx-prose > * + * { margin-top: 1em; }
.nx-prose h2, .nx-prose h3 { font-family: var(--nx-display); font-weight: 500; line-height: 1.2; margin-top: 1.6em; }
.nx-list .wp-block-post-template { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.nx-list .wp-block-post { padding: 28px; }
.nx-list .wp-block-post-title { font-family: var(--nx-display); font-weight: 500; font-size: 22px; }
.nx-list .wp-block-post-title a { color: var(--nx-ink); text-decoration: none; }
.nx-list .wp-block-post-excerpt { color: var(--nx-ink-soft); margin-top: 8px; }

/* Entrance: elements rest visible; motion only adds a gentle rise */
.rise { animation: nx-rise .9s cubic-bezier(.2,.7,.2,1) both; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .18s; } .d3 { animation-delay: .3s; } .d4 { animation-delay: .42s; }
@keyframes nx-rise { from { transform: translateY(14px); opacity: .001; } to { transform: none; opacity: 1; } }
@keyframes nx-drift { to { transform: translateX(30%); } }
@keyframes nx-bob { 50% { transform: translateY(10px); } }
@keyframes nx-pulse { 50% { opacity: .35; } }
@keyframes nx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Narrow screens */
@media (max-width: 1000px) {
  .nx-nav { padding-left: 16px; gap: 10px; }
  .nx-menu a { font-size: 16px; padding: 8px 12px; }
  .nx-brand-name { font-size: 13px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-block: 40px; }
  .orbit { width: min(340px, 100%); }
  .services { grid-template-columns: 1fr 1fr; }
  .services > .svc:first-child { grid-column: 1 / -1; }
  .contact { grid-template-columns: 1fr; padding: 30px; }
  .nx-article { padding: 28px; }
}
@media (max-width: 720px) {
  .nx-nav { flex-direction: column; align-items: stretch; border-radius: 28px; padding: 12px; gap: 8px; }
  .nx-brand { justify-content: center; }
  .nx-menu { justify-content: space-between; }
  .nx-menu li { flex: 1; display: flex; }
  .nx-menu a { font-size: 15px; padding: 8px 6px; flex: 1; }
  .nx-menu a .th { font-size: 10.5px; }
  .stats, .principles { grid-template-columns: 1fr; }
  .stat + .stat, .pr + .pr { border-left: 0; border-top: 1px solid var(--nx-line); }
  .services { grid-template-columns: 1fr; }
  .section { padding-block: 72px 0; }
}
