:root {
  --ink: #1f2925;
  --muted: #5b6a64;
  --paper: #fffdf8;
  --cream: #fff4df;
  --mint: #e6f4ed;
  --teal: #087d70;
  --teal-dark: #075f56;
  --brown: #7b4c2f;
  --line: #d8e6df;
  --shadow: 0 18px 48px rgba(31, 52, 44, 0.11);
  --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 226, 177, 0.48), transparent 28rem),
    linear-gradient(180deg, #f4faf6 0, #fff 32rem);
  font: 16px/1.75 system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif;
}

a { color: var(--teal-dark); }

a:hover { color: var(--brown); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #ffbf59;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  transform: translateY(-180%);
}

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

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(8, 125, 112, 0.14);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner,
.page-shell,
.site-footer-inner {
  width: min(var(--max), calc(100% - 32px));
  margin-inline: auto;
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.header-links,
.footer-links,
.breadcrumbs,
.link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.header-links a,
.footer-links a,
.breadcrumbs a {
  font-weight: 750;
  text-decoration: none;
}

.page-shell { padding: 44px 0 84px; }

.breadcrumbs {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 14px;
}

.hero-panel,
.content-panel,
.tool-panel,
.card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: clamp(28px, 6vw, 64px);
  background:
    linear-gradient(135deg, rgba(255, 244, 223, 0.96), rgba(230, 244, 237, 0.95)),
    #fff;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brown);
  font-weight: 900;
  letter-spacing: 0.03em;
}

h1,
h2,
h3 { line-height: 1.18; }

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(36px, 7vw, 68px);
  letter-spacing: -0.035em;
}

.lead {
  max-width: 760px;
  margin: 20px 0 0;
  color: #44554e;
  font-size: clamp(18px, 2.5vw, 22px);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  margin-top: 30px;
  align-items: start;
}

.content-panel { padding: clamp(24px, 5vw, 54px); }

.content-panel h2 {
  margin: 42px 0 10px;
  font-size: clamp(25px, 4vw, 34px);
}

.content-panel h2:first-child { margin-top: 0; }

.content-panel h3 {
  margin: 28px 0 8px;
  font-size: 21px;
}

.content-panel p,
.content-panel li { color: var(--muted); }

.content-panel strong { color: var(--ink); }

.side-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
}

.card {
  padding: 22px;
  box-shadow: 0 10px 30px rgba(31, 52, 44, 0.07);
}

.card h2,
.card h3 { margin: 0 0 8px; }

.card p { margin: 0; color: var(--muted); }

.card a { font-weight: 850; }

.formula,
.example,
.note {
  margin: 24px 0;
  padding: 20px 22px;
  border-radius: 18px;
}

.formula {
  border-left: 5px solid var(--teal);
  background: var(--mint);
  font-weight: 800;
}

.example { background: var(--cream); }

.note {
  border: 1px solid #e3d8c6;
  background: #fffaf0;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.button:hover { background: var(--teal-dark); color: #fff; }

.button.secondary {
  border: 1px solid var(--teal);
  background: transparent;
  color: var(--teal-dark);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.resource-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  justify-content: space-between;
}

.resource-card .tag {
  color: var(--brown);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 28px;
  margin-top: 30px;
  align-items: start;
}

.tool-panel { padding: clamp(22px, 4vw, 38px); }

.form-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #aec8bd;
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

.result-grid { margin-top: 22px; }

.result {
  min-height: 112px;
  padding: 17px;
  border-radius: 17px;
  background: var(--mint);
}

.result span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.result strong {
  display: block;
  margin-top: 6px;
  color: var(--teal-dark);
  font-size: clamp(24px, 4vw, 34px);
}

.calculator-status[aria-live] { margin-top: 18px; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th { background: #f2f8f4; }

.site-footer {
  border-top: 1px solid var(--line);
  background: #f3f8f4;
}

.site-footer-inner {
  padding: 30px 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .content-grid,
  .tool-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

@media (max-width: 620px) {
  .header-inner {
    padding: 10px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .header-links { gap: 8px 14px; }
  .page-shell { padding-top: 28px; }
  .resource-grid,
  .form-grid,
  .result-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 0; }
  .site-footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
