:root {
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d8dee8;
  --paper: #ffffff;
  --soft: #f4f6f9;
  --brand: #155e9f;
  --brand-dark: #071427;
  --cyan: #06b6d4;
  --green: #0f766e;
  --danger: #b42318;
  --focus: #0e7490;
  --shadow: 0 20px 56px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(224, 242, 254, 0.72), rgba(255, 247, 237, 0.56) 34%, rgba(248, 250, 252, 0.94) 72%),
    var(--soft);
  font-family: "Kanit", Tahoma, "Noto Sans Thai", Arial, sans-serif;
  line-height: 1.65;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-dark);
}

.skip-link:focus { transform: translateY(0); }

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.tools-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: clamp(610px, 70vh, 760px);
  align-items: center;
  overflow: hidden;
  padding: clamp(72px, 9vw, 118px) 0 clamp(68px, 8vw, 104px);
  color: #fff;
  background: #04152b;
}

.tools-hero::before {
  content: "";
  position: absolute;
  z-index: -3;
  inset: -4%;
  background: url("/assets/hero-technology-background.png") center right / cover no-repeat;
  transform: scale(1.04);
  animation: hero-background-drift 18s ease-in-out infinite alternate;
}

.tools-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 49%, rgba(0, 214, 255, .08), transparent 31%),
    linear-gradient(90deg, rgba(3, 16, 37, .98) 0%, rgba(3, 22, 52, .91) 38%, rgba(3, 27, 60, .36) 69%, rgba(2, 20, 43, .13) 100%),
    linear-gradient(180deg, rgba(0, 9, 25, .1), rgba(0, 11, 28, .34));
}

.tools-hero .shell { position: relative; z-index: 2; }
.tools-hero .hero-content { width: min(1480px, calc(100% - clamp(32px, 8vw, 136px))); }

.hero-visual { position: absolute; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.hero-grid {
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image: linear-gradient(rgba(67, 178, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(67, 178, 255, .08) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: linear-gradient(90deg, transparent 3%, #000 42%, #000 88%, transparent);
  animation: hero-grid-shift 14s linear infinite;
}
.hero-orbit {
  position: absolute;
  right: -7%;
  border: 1px solid rgba(22, 219, 255, .55);
  border-left-color: transparent;
  border-bottom-color: rgba(22, 219, 255, .2);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px rgba(23, 212, 255, .45));
  transform: rotate(-11deg);
  animation: hero-orbit-float 7s ease-in-out infinite alternate;
}
.hero-orbit-one { top: 25%; width: 58%; height: 35%; }
.hero-orbit-two { top: 45%; right: -10%; width: 65%; height: 40%; animation-delay: -3.5s; }
.network-node {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(220, 253, 255, .95);
  border-radius: 50%;
  background: #13e2f7;
  box-shadow: 0 0 0 7px rgba(13, 226, 247, .08), 0 0 22px 7px rgba(13, 226, 247, .75);
  animation: network-node-pulse 2.8s ease-in-out infinite;
}
.node-one { top: 26%; right: 20%; }
.node-two { top: 42%; right: 10%; animation-delay: -.6s; }
.node-three { top: 55%; right: 30%; animation-delay: -1.1s; }
.node-four { top: 69%; right: 17%; animation-delay: -1.7s; }
.node-five { top: 77%; right: 39%; animation-delay: -2.2s; }
.node-six { top: 34%; right: 43%; animation-delay: -.9s; }
.hero-data-label, .hero-process {
  position: absolute;
  display: grid;
  color: rgba(176, 221, 244, .54);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: .04em;
  animation: hero-label-float 6s ease-in-out infinite alternate;
}
.hero-data-label-top { top: 10%; right: 34%; }
.hero-data-label-bottom { right: 27%; bottom: 10%; animation-delay: -3s; }
.hero-data-label i { width: 34px; height: 1px; margin-top: 10px; background: #4ad8ff; }
.hero-process { top: 8%; right: 5%; min-width: 108px; padding: 16px; border: 1px solid rgba(80, 193, 238, .13); border-radius: 12px; background: rgba(2, 27, 59, .18); }
.hero-process span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-process span::after { content: ""; width: 28px; height: 1px; background: rgba(48, 202, 249, .42); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  color: #dff9fb;
  font-size: clamp(.96rem, 1.2vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0;
  animation: hero-content-in .7s .08s ease-out forwards;
}

.eyebrow svg, .trust-item svg, .privacy-note svg, .tool-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tools-hero h1 {
  max-width: 870px;
  margin: 0;
  font-size: clamp(2.65rem, 5.25vw, 5.25rem);
  font-weight: 700;
  line-height: 1.13;
  letter-spacing: -0.045em;
  text-wrap: balance;
  text-shadow: 0 8px 30px rgba(0, 8, 25, .34);
  opacity: 0;
  transform: translateY(22px);
  animation: hero-content-in .85s .18s cubic-bezier(.2,.75,.25,1) forwards;
}

.tools-hero .lede {
  max-width: 820px;
  margin: 26px 0 0;
  color: rgba(235, 246, 255, .82);
  font-size: clamp(1.05rem, 1.7vw, 1.38rem);
  line-height: 1.9;
  opacity: 0;
  transform: translateY(22px);
  animation: hero-content-in .85s .32s cubic-bezier(.2,.75,.25,1) forwards;
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.trust-item { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: clamp(.92rem, 1.25vw, 1.08rem); font-weight: 500; opacity: 0; transform: translateY(14px); animation: hero-content-in .7s .5s ease-out forwards; }
.trust-item:nth-child(2) { animation-delay: .6s; }
.trust-item:nth-child(3) { animation-delay: .7s; }

@keyframes hero-background-drift {
  from { transform: scale(1.04) translate3d(-.4%, -.4%, 0); }
  to { transform: scale(1.09) translate3d(1.1%, .7%, 0); }
}
@keyframes hero-grid-shift { to { background-position: 60px 60px; } }
@keyframes network-node-pulse { 0%, 100% { opacity: .55; transform: scale(.72); } 50% { opacity: 1; transform: scale(1.18); } }
@keyframes hero-orbit-float { from { transform: rotate(-11deg) translateY(-5px) scale(.99); opacity: .42; } to { transform: rotate(-9deg) translateY(8px) scale(1.025); opacity: .8; } }
@keyframes hero-label-float { from { transform: translateY(-4px); opacity: .48; } to { transform: translateY(7px); opacity: .72; } }
@keyframes hero-content-in { to { opacity: 1; transform: translateY(0); } }

.tools-main { min-height: 48vh; padding: clamp(42px, 7vw, 76px) 0; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -.02em; }
.section-heading p { max-width: 640px; margin: 7px 0 0; color: var(--muted); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

/* Tools directory: five slots per desktop row, with readable smaller layouts. */
body[data-tool-page="hub"] .tools-grid { grid-template-columns: minmax(0, 1fr); }
body[data-tool-page="hub"] .tool-card { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 561px) {
  body[data-tool-page="hub"] .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  body[data-tool-page="hub"] .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  body[data-tool-page="hub"] .tools-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
  body[data-tool-page="hub"] .tool-card { padding: 20px; }
}

.tool-card {
  display: flex;
  min-height: 255px;
  flex-direction: column;
  padding: 26px;
  border: 1px solid rgba(216, 222, 232, .95);
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.tool-card:hover { transform: translateY(-3px); border-color: #b8c7d9; box-shadow: 0 18px 40px rgba(15,23,42,.1); }
.tool-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 12px; color: var(--brand); background: #e8f4ff; }
.tool-icon svg { width: 24px; height: 24px; }
.tool-category { margin: 19px 0 4px; color: var(--green); font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.tool-card h3 { margin: 0; font-size: 1.35rem; }
.tool-card p { margin: 8px 0 22px; color: var(--muted); }
.tool-card .text-link { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; color: var(--brand); font-weight: 600; text-decoration: none; }
.tool-card .text-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .18s ease; }
.tool-card .text-link:hover svg { transform: translateX(3px); }

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 32px;
  padding: 18px 20px;
  border: 1px solid #b9ddd8;
  border-radius: 14px;
  color: #134e4a;
  background: rgba(240,253,250,.88);
}
.privacy-note svg { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; }
.privacy-note strong { display: block; }
.privacy-note p { margin: 2px 0 0; color: #356c68; }

.site-footer { padding: 28px 16px 34px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; background: rgba(255,255,255,.72); }
.site-footer a { color: var(--brand); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid rgba(14,116,144,.42); outline-offset: 3px; }

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 1160px); }
  .tools-hero { min-height: 620px; padding: 70px 0 64px; }
  .tools-hero .hero-content { width: min(100% - 28px, 1160px); }
  .tools-hero::before { background-position: 66% center; }
  .tools-hero::after { background: linear-gradient(90deg, rgba(3, 16, 37, .98), rgba(3, 22, 52, .88) 72%, rgba(3, 27, 60, .42)); }
  .tools-hero h1 { font-size: clamp(2.45rem, 13vw, 3.6rem); }
  .tools-hero .lede { margin-top: 20px; line-height: 1.7; }
  .trust-list { display: grid; gap: 12px; margin-top: 26px; }
  .hero-data-label, .hero-process { display: none; }
  .hero-orbit { right: -42%; width: 110%; opacity: .5; }
  .node-five, .node-six { display: none; }
  .tool-card { min-height: 0; padding: 22px; }
  .privacy-note { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .eyebrow, .tools-hero h1, .tools-hero .lede, .trust-item { opacity: 1; transform: none; }
}
