/*! Skuti Science – theme (WordPress-inspired, light/dark, responsive) */
:root {
  --bg: #f6f7f7; --surface: #fff; --surface-2: #f0f0f1; --text: #1d2327; --muted: #50575e; --border: #dcdcde;
  --accent: #2271b1; --accent-2: #135e96; --accent-soft: #e8f1f9; --ok: #00a32a; --err: #b32d2e; --err-bg: #fcf0f1;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --c-alkali: #ff8a80; --c-alkaline: #ffcc80; --c-transition: #ffe082; --c-post: #c5e1a5; --c-metalloid: #a5d6a7;
  --c-nonmetal: #80deea; --c-halogen: #90caf9; --c-noble: #ce93d8; --c-lanthanide: #f8bbd0; --c-actinide: #bcaaa4; --el-text: #1d2327;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #101418; --surface: #181d23; --surface-2: #222930; --text: #e6e8ea; --muted: #a2aab2; --border: #2f3740;
  --accent: #72aee6; --accent-2: #9ec2e6; --accent-soft: #1b2a38; --ok: #4ab866; --err: #f1878a; --err-bg: #3a1d20;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --c-alkali: #b5524a; --c-alkaline: #b37a3a; --c-transition: #a08a2e; --c-post: #5f8a3c; --c-metalloid: #3f8a55;
  --c-nonmetal: #2f8a96; --c-halogen: #3a6fa8; --c-noble: #7e4c99; --c-lanthanide: #a0506f; --c-actinide: #75625b; --el-text: #fff;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
img, svg, canvas { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 1.4em 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); margin-top: .3em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.h-small { font-size: 1rem; margin: 1em 0 .4em; color: var(--muted); }
code, kbd { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .6em 1em; z-index: 100; }
.skip-link:focus { left: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.brand small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: .1rem; margin: 0; padding: 0; }
.site-nav a { display: block; padding: .4rem .5rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 40px; height: 40px; border-radius: 8px; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; flex: none; }
.icon-btn:hover { border-color: var(--accent); }
#nav-toggle { display: none; }
@media (max-width: 1500px) { .brand small { display: none; } }
@media (max-width: 1140px) {
  #nav-toggle { display: grid; margin-left: auto; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--border); display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: .5rem 1rem 1rem; }
  .brand small { display: none; }
}

/* layout */
main { flex: 1; padding: 1rem 0 3rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin: .6rem 0 0; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.crumbs li + li::before { content: "›"; margin-right: .3rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 75ch; margin-top: 0; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.layout.full { grid-template-columns: minmax(0, 1fr); }
.layout.full .sidebar { display: none; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1.25rem; }
.panel > h2:first-child { margin-top: 0; }
.prose { max-width: 75ch; }
.sidebar .panel h2 { font-size: 1rem; margin: 0 0 .6rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: .3rem 0; text-decoration: none; border-bottom: 1px dashed var(--border); font-size: .93rem; }

/* hero + search */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { margin-bottom: .4rem; }
.hero .lead { margin: 0 auto 1.2rem; }
.search { position: relative; max-width: 640px; margin: 0 auto 1rem; }
.search input { width: 100%; padding: .85rem 1rem .85rem 2.6rem; font-size: 1.05rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search::before { content: "🔍"; position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: .95rem; opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 0 0 1rem; padding: 0; list-style: none; }
.chips a { display: inline-flex; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: .9rem; }
.chips a:hover { border-color: var(--accent); color: var(--accent); }
#no-results { text-align: center; color: var(--muted); }

/* cards */
.cat-section h2 { display: flex; align-items: baseline; gap: .5rem; }
.cat-section h2 a { text-decoration: none; color: inherit; }
.cat-section h2 .count { font-size: .85rem; color: var(--muted); font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; list-style: none; padding: 0; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card a { display: block; padding: .8rem 1rem; text-decoration: none; color: var(--text); height: 100%; }
.card strong { display: block; color: var(--accent); font-size: .98rem; margin-bottom: .15rem; }
.card span { font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* tool form */
.tool .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field.wide, .field.area { grid-column: 1 / -1; }
.lbl { font-size: .88rem; font-weight: 600; color: var(--text); }
.lbl .unit { font-weight: 400; color: var(--muted); }
.lbl .opt { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea, button { font: inherit; }
.field input, .field select, .field textarea, .conv-top input, .conv-top select, .pt-filter {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); min-height: 42px; }
.field textarea { min-height: 110px; font-family: var(--mono); font-size: .9rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); color: var(--accent); }
.btn.copied::after, output.copied::after { content: " ✓ copied"; color: var(--ok); font-weight: 400; font-size: .85em; }
.tool-error { background: var(--err-bg); color: var(--err); border-left: 4px solid var(--err); padding: .6rem .9rem; border-radius: 4px; margin: 1rem 0 0; }
.results { margin-top: 1.2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.results h2 { grid-column: 1 / -1; margin: 0; font-size: 1rem; }
.out { background: var(--accent-soft); border-radius: 8px; padding: .55rem .8rem; min-width: 0; }
.out.wide { grid-column: 1 / -1; }
.out .lbl { display: block; font-weight: 500; color: var(--muted); font-size: .82rem; }
.out output { display: block; font-size: 1.12rem; font-weight: 650; overflow-wrap: anywhere; cursor: copy; font-variant-numeric: tabular-nums; }
.out.wide output { font-family: var(--mono); font-size: .92rem; font-weight: 500; white-space: pre-wrap; }
.out.empty output { color: var(--muted); font-weight: 400; }
.swatch { height: 64px; border-radius: 8px; border: 1px solid var(--border); margin-top: 1rem; }
.formula { list-style: none; padding: 0; margin: 0; }
.formula li { font-family: "Cambria Math", "STIX Two Math", Cambria, Georgia, serif; font-size: 1.08rem; background: var(--surface-2); padding: .45rem .8rem; border-radius: 6px; margin-bottom: .4rem; overflow-x: auto; }

/* calculator */
.calc { max-width: 560px; }
.calc-top { background: var(--surface-2); border-radius: 8px; padding: .6rem; display: grid; grid-template-columns: auto 1fr; gap: .4rem; align-items: center; }
.calc-mode { border: 1px solid var(--border); background: var(--surface); color: var(--accent); border-radius: 6px; padding: .35rem .6rem; font-weight: 700; cursor: pointer; font-size: .8rem; }
.calc-input { border: 0; background: transparent; color: var(--text); font: 500 1.3rem var(--mono); text-align: right; min-width: 0; padding: .3rem; }
.calc-input:focus { outline: none; }
.calc-result { grid-column: 1 / -1; text-align: right; font: 700 1.6rem var(--mono); overflow-wrap: anywhere; }
.calc-result.err { color: var(--err); font-size: 1rem; font-weight: 500; }
.calc-keys { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .6rem; }
.calc-fn, .calc-num { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; align-content: start; }
.key { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: .65rem 0; cursor: pointer; font-size: .92rem; min-height: 44px; touch-action: manipulation; }
.key:hover { border-color: var(--accent); }
.key:active { transform: scale(.97); }
.key.num { background: var(--surface-2); font-weight: 600; font-size: 1.05rem; }
.key.eq { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.key.del { color: var(--err); font-weight: 600; }
@media (max-width: 520px) { .calc-keys { grid-template-columns: 1fr; } .calc-num { order: -1; } }
.calc-history { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; }
.hist-item { width: 100%; text-align: right; background: none; border: 0; border-bottom: 1px dashed var(--border); padding: .35rem; color: var(--muted); font-family: var(--mono); cursor: pointer; }
.hist-item:hover { color: var(--accent); }

/* plotter */
.plot-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.plot-form .wide { grid-column: 1 / -1; }
.plot-form input { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-family: var(--mono); }
@media (max-width: 600px) { .plot-form { grid-template-columns: 1fr 1fr; } }
.plot-wrap { margin-top: .8rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.plot { display: block; cursor: crosshair; }
.plot-info { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; font-family: var(--mono); font-size: .88rem; }
.legend-item { border-left: 4px solid; padding-left: .4rem; }
.legend-item[data-c="0"] { border-color: #2271b1; } .legend-item[data-c="1"] { border-color: #d63638; } .legend-item[data-c="2"] { border-color: #00a32a; }
.legend-item[data-c="3"] { border-color: #dba617; } .legend-item[data-c="4"] { border-color: #8c5fc7; } .legend-item[data-c="5"] { border-color: #e26f56; }

/* converter */
.conv-top { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.conv-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.conv-table th, .conv-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.conv-table td output { font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; cursor: copy; }
.conv-table tr.sel { background: var(--accent-soft); }
.conv-table .sym { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.hint { font-size: .85rem; color: var(--muted); }

/* periodic table */
.pt-tools { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.pt-filter { max-width: 280px; }
.pt-legend { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0; }
.pt-legend button { border: 1px solid var(--border); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; cursor: pointer; color: var(--el-text); }
.pt-legend button[aria-pressed="true"] { outline: 2px solid var(--text); }
.pt-scroll { overflow-x: auto; padding-bottom: .5rem; }
.pt { display: grid; grid-template-columns: repeat(18, minmax(48px, 1fr)); grid-template-rows: repeat(7, auto) 14px auto auto; gap: 3px; min-width: 900px; list-style: none; padding: 0; margin: 0; }
.el a { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1 / 1.1; border-radius: 5px; text-decoration: none; color: var(--el-text); padding: 2px; transition: transform .1s, opacity .15s; line-height: 1.1; }
.el a:hover, .el a:focus { transform: scale(1.12); position: relative; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.el .z { font-size: .62rem; align-self: flex-start; opacity: .85; }
.el .sym { font-size: 1.05rem; font-weight: 700; }
.el .nm { font-size: .52rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el .ms { font-size: .5rem; opacity: .85; }
.el.dim { opacity: .18; }
.cat-alkali { background: var(--c-alkali); } .cat-alkaline { background: var(--c-alkaline); } .cat-transition { background: var(--c-transition); }
.cat-post { background: var(--c-post); } .cat-metalloid { background: var(--c-metalloid); } .cat-nonmetal { background: var(--c-nonmetal); }
.cat-halogen { background: var(--c-halogen); } .cat-noble { background: var(--c-noble); } .cat-lanthanide { background: var(--c-lanthanide); }
.cat-actinide { background: var(--c-actinide); }
.pt-gap { grid-row: 8; grid-column: 1 / -1; }
.r1 { grid-row: 1; } .r2 { grid-row: 2; } .r3 { grid-row: 3; } .r4 { grid-row: 4; } .r5 { grid-row: 5; } .r6 { grid-row: 6; } .r7 { grid-row: 7; } .r9 { grid-row: 9; } .r10 { grid-row: 10; }
.c1 { grid-column: 1; } .c2 { grid-column: 2; } .c3 { grid-column: 3; } .c4 { grid-column: 4; } .c5 { grid-column: 5; } .c6 { grid-column: 6; }
.c7 { grid-column: 7; } .c8 { grid-column: 8; } .c9 { grid-column: 9; } .c10 { grid-column: 10; } .c11 { grid-column: 11; } .c12 { grid-column: 12; }
.c13 { grid-column: 13; } .c14 { grid-column: 14; } .c15 { grid-column: 15; } .c16 { grid-column: 16; } .c17 { grid-column: 17; } .c18 { grid-column: 18; }
.el-hero { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.el-big { width: 150px; height: 160px; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--el-text); }
.el-big .z { font-size: 1rem; } .el-big .sym { font-size: 3.2rem; font-weight: 800; line-height: 1; } .el-big .ms { font-size: .9rem; }
.facts { width: 100%; border-collapse: collapse; }
.facts th, .facts td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.facts th { width: 40%; color: var(--muted); font-weight: 500; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2rem 0 calc(1.5rem + env(safe-area-inset-bottom)); font-size: .9rem; color: var(--muted); }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.site-footer h2 { font-size: .95rem; margin: 0 0 .5rem; color: var(--text); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: .2rem 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .legal { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }

@media print {
  .site-header, .site-footer, .sidebar, .actions, .search, .crumbs { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
