:root {
  --bg: #ffffff;
  --fg: #14283f;
  --muted: #4a5b6e;
  --primary: #f89820;
  --primary-dark: #c46d07;
  --java-blue: #3d6b8f;
  --java-blue-dark: #1f3a5c;
  --border: #c3d1df;
  --border-strong: #9aabbf;
  --card-bg: #eaf0f6;
  --accent: #ffe4bd;
  --radius: 6px;
  --radius-sm: 4px;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Fira Code", Menlo, Consolas, monospace;
  --shadow: 0 1px 3px rgba(20,40,63,.1), 0 1px 2px rgba(20,40,63,.06);
  --shadow-md: 0 6px 12px -2px rgba(20,40,63,.12), 0 3px 6px -3px rgba(20,40,63,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--java-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--java-blue-dark);
}
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: 1.6rem; margin: 2rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
code, pre, kbd, .tool-output code, .live-clock { font-family: var(--font-mono); }

.container { max-width: 1320px; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(20,40,63,.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header > .container.header-row {
  max-width: none;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem clamp(1.5rem, 5vw, 3.5rem);
  flex-wrap: wrap;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  letter-spacing: -.01em;
}
.brand-logo { width: 40px; height: 40px; display: block; border-radius: 8px; box-shadow: 0 1px 3px rgba(20,40,63,.18); }
.site-nav {
  display: flex;
  gap: .35rem 1.1rem;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}
.site-nav .search-form { margin-left: .75rem; }

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .15rem .35rem .15rem .5rem;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 420px;
}
.search-form input[type="search"] {
  border: 0;
  background: transparent;
  padding: .4rem .5rem;
  min-width: 0;
  width: 100%;
  color: var(--fg);
  font-size: .95rem;
  outline: none;
}
.search-form button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
}
.search-form.big { margin: 1.5rem 0; padding: .25rem .5rem; }
.search-form.big input[type="search"] { min-width: 0; width: 100%; font-size: 1.05rem; padding: .6rem .5rem; }
.search-form.big button { background: var(--primary); color: #fff; padding: .55rem 1.2rem; border-radius: 6px; font-weight: 600; }
.search-form.big button:hover { background: var(--primary-dark); }

.autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  list-style: none;
  margin: 0;
  padding: .25rem 0;
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
}
.autocomplete li a {
  display: block;
  padding: .5rem .75rem;
  color: var(--fg);
}
.autocomplete li a:hover,
.autocomplete li.hl a { background: var(--accent); text-decoration: none; }

.lang-switch { display: flex; list-style: none; margin: 0; padding: 0; gap: .25rem; }
.lang-switch li a { padding: .3rem .55rem; border-radius: 6px; color: var(--muted); font-size: .85rem; text-transform: uppercase; }
.lang-switch li.active a { background: var(--accent); color: var(--primary-dark); font-weight: 600; }

main { padding: 1.5rem 1rem 3rem; }

.hero {
  padding: 2rem 0 1rem;
}
.hero h1 { color: var(--fg); }
.hero .lead { color: var(--muted); font-size: 1.1rem; max-width: 640px; }
.hero-search {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  max-width: 640px;
}
.hero-search input[type="search"] {
  flex: 1;
  padding: .75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
}
.hero-search button {
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}
.hero-search button:hover { background: var(--primary-dark); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: transform .1s ease, box-shadow .1s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card a { color: inherit; }
.card h3 { font-size: 1rem; color: var(--java-blue); }
.card-meta { font-size: .8rem; color: var(--muted); margin: .25rem 0 .5rem; }
.excerpt { font-size: .9rem; color: var(--muted); margin: 0; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .7rem;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  color: var(--fg);
}
.tag:hover { background: var(--accent); text-decoration: none; border-color: var(--primary); }
.tag span { color: var(--muted); font-size: .75rem; }
.tag.small { font-size: .75rem; padding: .2rem .55rem; }

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .5rem;
}
.article-list li {
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.article-list .muted { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.breadcrumbs {
  font-size: .82rem;
  margin: 1rem 0 1.25rem;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: center;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  color: var(--muted);
}
.breadcrumbs li + li::before {
  content: '›';
  margin: 0 .4rem;
  color: var(--border);
  font-size: .9em;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--fg); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--fg); font-weight: 500; }

.article {
  max-width: 920px;
  margin: 0 auto;
}
.article .prose { font-size: 1.08rem; }
.article .subtitle { color: var(--muted); margin: 0 0 1rem; }
.article-meta { color: var(--muted); font-size: .85rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.prose { margin: 1.5rem 0; font-size: 1.05rem; }
.prose p { margin: 0 0 1rem; }
.prose .placeholder {
  padding: 1rem;
  background: var(--accent);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
}
.prose code {
  background: var(--card-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .9em;
}
.prose pre {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
}
.prose pre code { background: none; padding: 0; }

.tag-row { margin: 1.5rem 0 1rem; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

.keywords-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}
.keywords-box h2 { margin-top: 0; font-size: 1rem; }
.keywords-box ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.keywords-box small { color: var(--muted); font-size: .75rem; }

.related { margin-top: 3rem; }

.search-results { list-style: none; padding: 0; margin: 1rem 0; }
.search-results li { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.search-results li a { font-size: 1.05rem; font-weight: 600; }
mark { background: #fff3a3; color: inherit; padding: 0 2px; border-radius: 2px; }

.pagination {
  display: flex;
  gap: .25rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}
.pagination a {
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: .9rem;
  min-width: 40px;
  text-align: center;
}
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover:not(.active) { background: var(--card-bg); text-decoration: none; }

.ad {
  margin: 1.5rem 0;
  min-height: 90px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  color: var(--muted);
  font-size: .9rem;
  margin-top: 3rem;
}
.mega-footer {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2rem 1.75rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 1100px) { .mega-footer { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .mega-footer { grid-template-columns: repeat(2, 1fr); } }
.mega-col h4 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fg);
  margin: 0 0 .75rem;
}
.mega-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.mega-col ul li a { color: var(--muted); font-size: .875rem; }
.mega-col ul li a:hover { color: var(--fg); text-decoration: none; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding-top: 1.25rem;
  font-size: .82rem;
}
.footer-bottom p { margin: 0; }
.footer-bottom ul { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; }
.footer-bottom ul a { color: var(--muted); }

.not-found { text-align: center; padding: 3rem 1rem; }

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  padding: 1rem 1rem;
  z-index: 100;
  font-size: .9rem;
}
.cookie-banner-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.cookie-text p { margin: .25rem 0 0; color: var(--muted); max-width: 640px; }
.cookie-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.cookie-actions button {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  padding: .5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
}
.cookie-actions .btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cookie-actions .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.cookie-actions .btn-secondary:hover { background: var(--accent); }

/* Header nav link */
.nav-link {
  padding: .4rem .75rem;
  border-radius: 6px;
  color: var(--fg);
  font-weight: 600;
  font-size: .95rem;
}
.nav-link:hover { background: var(--accent); color: var(--primary-dark); text-decoration: none; }

/* Tool pages */
.tool-page { max-width: 960px; }
.tool-card h3 { color: var(--primary-dark); }

.tool-ui {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.tool-controls label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .85rem;
  color: var(--muted);
}
.tool-controls label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: .4rem;
  color: var(--fg);
  font-size: .9rem;
}
.tool-controls input[type="text"],
.tool-controls select {
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: .95rem;
  min-width: 200px;
  font-family: inherit;
}
.tool-controls fieldset.mode-switch {
  display: flex;
  gap: .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .5rem;
}
.tool-controls fieldset.mode-switch label {
  flex-direction: row;
  align-items: center;
  gap: .3rem;
  color: var(--fg);
  font-size: .9rem;
}

.tool-buttons {
  margin-left: auto;
  display: flex;
  gap: .5rem;
}
.tool-buttons button,
.tool-snippet-header button,
.tool-row button {
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--fg);
  font-weight: 500;
  cursor: pointer;
  font-size: .9rem;
}
.tool-buttons .btn-primary,
.tool-snippet-header .btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tool-buttons .btn-primary:hover,
.tool-snippet-header .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.tool-buttons .btn-secondary:hover,
.tool-row .btn-secondary:hover { background: var(--accent); }

.tool-io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tool-pane { display: flex; flex-direction: column; }
.tool-pane label {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .25rem;
  font-weight: 600;
}
.tool-pane textarea {
  width: 100%;
  min-height: 280px;
  font-family: var(--font-mono);
  font-size: .9rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
}
.tool-pane pre {
  margin: 0;
  min-height: 280px;
  background: #f8f5ee;
  border-radius: 6px;
  overflow: auto;
}
.tool-pane pre code {
  display: block;
  padding: .75rem !important;
  font-size: .85rem;
  white-space: pre;
}
.tool-error {
  color: #c0392b;
  font-size: .85rem;
  margin: .5rem 0 0;
  min-height: 1.2em;
}

.tool-row {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tool-row label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .85rem;
  color: var(--muted);
}
.tool-row label.grow { flex: 1; min-width: 260px; }
.tool-row input, .tool-row select {
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: .95rem;
  font-family: inherit;
}

.live-clock {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--muted);
  padding: .5rem .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-block;
  margin: 0 0 1rem;
}

.tool-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.tool-output {
  display: flex;
  flex-direction: column;
  padding: .6rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.tool-output .label {
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-bottom: .25rem;
}
.tool-output code {
  font-size: .9rem;
  word-break: break-word;
}

.tool-snippet {
  margin-top: 1rem;
}
.tool-snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
}
.tool-snippet pre {
  margin: 0;
  border-radius: 6px;
  overflow: auto;
  background: #f8f5ee;
}

@media (max-width: 720px) {
  .tool-io { grid-template-columns: 1fr; }
  .tool-controls { gap: .5rem; }
  .tool-buttons { margin-left: 0; width: 100%; }
  .tool-buttons button { flex: 1; }
}

/* Compiler page */
.compiler-wrap {
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  position: relative;
  box-shadow: 0 6px 22px rgba(0,0,0,.08);
  transition: box-shadow .3s ease, outline-color .3s ease;
  outline: 2px solid transparent;
}
.compiler-wrap .tool-controls {
  padding: .9rem 1.25rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.compiler-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  flex-wrap: wrap;
}
.compiler-branding {
  font-size: .9rem;
  color: var(--muted);
}
.compiler-branding strong {
  color: var(--fg);
}
.compiler-bar-actions {
  display: flex;
  gap: .5rem;
}
.compiler-bar-actions .btn-secondary {
  padding: .4rem .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.compiler-bar-actions .btn-secondary:hover {
  background: var(--accent);
  text-decoration: none;
}
.compiler-wrap iframe {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
  background: #f8f5ee;
  overflow: hidden;
}
.compiler-fallback {
  font-size: .85rem;
  color: var(--muted);
  margin: 0 0 0 auto;
}
.compiler-fallback a {
  color: var(--primary-dark);
  font-weight: 600;
}
.compiler-fallback.only-link {
  font-size: 1rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--fg);
}
.compiler-fallback.only-link a {
  display: inline-block;
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
}

/* Wide variant: larger than the article reading width (960px),
   but with breathing room on the sides — not edge-to-edge.
   Extends beyond the main container but capped at 1400px on large screens. */
.compiler-full {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 4rem), 1400px);
}

/* Flash effect when "Try in compiler" scrolls the iframe into view */
.compiler-wrap.flash {
  outline-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(248, 152, 32, .25);
}

/* Paste toast */
.paste-toast {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1d1d1f;
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  max-width: 90%;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 10;
}
.paste-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Table of contents */
.compiler-page .toc {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.compiler-page .toc h2 {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.compiler-page .toc ul {
  margin: 0;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2rem;
  list-style: disc;
}
.compiler-page .toc li {
  break-inside: avoid;
  margin: .15rem 0;
}
.compiler-page .toc a { color: var(--java-blue); }

/* Comparison table — wider, horizontal scroll on mobile */
.comparison-table {
  width: 100%;
  font-size: .85rem;
  border-collapse: collapse;
}
.comparison-table th,
.comparison-table td {
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.comparison-table th {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
}
.comparison-table tr:nth-child(even) td { background: var(--card-bg); }
.compiler-page .prose { overflow-x: auto; }

.template-note {
  font-size: .85rem;
  color: var(--muted);
  padding: .5rem 1rem;
  margin: 0;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: inherit;
  font-size: .85em;
  line-height: 1.4;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

.tool-card.featured {
  border-left: 4px solid var(--primary);
  background: linear-gradient(to right, var(--accent), var(--card-bg) 60%);
}
.tool-card.featured h3 { color: var(--primary-dark); }

/* Code templates on compiler page */
.template {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  overflow: hidden;
}
.template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  flex-wrap: wrap;
}
.template-header h3 {
  margin: 0;
  font-size: 1rem;
}
.template-buttons {
  display: flex;
  gap: .5rem;
}
.template-buttons button {
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  background: var(--bg);
  color: var(--fg);
}
.template-buttons .btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.template-buttons .btn-primary:hover { background: var(--primary-dark); }
.template-buttons .btn-secondary:hover { background: var(--accent); }
.template pre {
  margin: 0;
  border-radius: 0;
  border: none;
  background: #f8f5ee;
}

/* Base64 file input */
.file-upload { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.file-upload input[type="file"] { font-size: .85rem; }

@media (max-width: 720px) {
  .compiler-wrap iframe { height: 440px; }
  .template-header { gap: .5rem; }
  .template-buttons { width: 100%; }
  .template-buttons button { flex: 1; }
  .compiler-fallback { margin-left: 0; width: 100%; }
  .compiler-page .toc ul { columns: 1; }
  .paste-toast { font-size: .8rem; padding: .5rem .75rem; }
}

@media (max-width: 640px) {
  .article-list li { flex-direction: column; gap: .25rem; }
}

/* ── Mobile drawer nav ────────────────────────────────── */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-backdrop { display: none; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    background: var(--java-blue-dark);
    color: #fff;
    padding: 1.25rem 1.25rem 1.5rem;
    margin: 0;
    gap: .15rem;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(20,40,63,.25);
    z-index: 50;
  }
  .site-nav::before {
    content: '';
    display: block;
    height: 3rem;
    margin: -1.25rem -1.25rem 1rem;
    background: linear-gradient(135deg, var(--java-blue-dark), #16293e);
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .nav-toggle { z-index: 60; position: relative; }
  body.nav-open .nav-toggle {
    background: transparent;
    border-color: rgba(255,255,255,.3);
  }
  body.nav-open .nav-toggle span { background: #fff; }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20,40,63,.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 40;
  }
  body.nav-open .site-nav { transform: translateX(0); }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .site-nav .nav-link {
    display: flex;
    align-items: center;
    color: #fff;
    padding: .7rem .9rem;
    font-size: 1.02rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    font-weight: 500;
  }
  .site-nav .nav-link:hover,
  .site-nav .nav-link:focus-visible {
    background: rgba(255,255,255,.06);
    border-left-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
  }

  .site-nav .search-form {
    flex: 0 0 auto;
    margin: 1.25rem 0 .5rem;
    max-width: none;
    width: 100%;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.15);
    padding: .3rem .5rem;
  }
  .site-nav .search-form input[type="search"] { color: #fff; }
  .site-nav .search-form input[type="search"]::placeholder { color: rgba(255,255,255,.55); }
  .site-nav .search-form button { color: rgba(255,255,255,.7); }

  .site-nav .lang-switch {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.12);
    justify-content: flex-start;
  }
  .site-nav .lang-switch li a { color: rgba(255,255,255,.7); }
  .site-nav .lang-switch li.active a { background: var(--primary); color: #fff; }

  .brand { font-size: 1.15rem; }
  .brand-logo { width: 36px; height: 36px; }
}

/* FAQ */
.faq-toc { margin: 1.5rem 0 2rem; padding: 1rem 1.25rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; }
.faq-toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.faq-toc-list a { color: var(--java-blue); text-decoration: none; font-weight: 500; }
.faq-toc-list a:hover { text-decoration: underline; }
.faq-count { color: var(--muted); font-weight: 400; font-size: .9em; }

.faq-group { margin: 2.5rem 0; }
.faq-group h2 { border-bottom: 2px solid var(--primary); padding-bottom: .4rem; margin-bottom: 1rem; }
.faq-item { border: 1px solid var(--border); border-radius: 6px; margin-bottom: .6rem; background: var(--card-bg); scroll-margin-top: 80px; }
.faq-item > summary { cursor: pointer; padding: .9rem 1rem; font-weight: 500; list-style: none; position: relative; padding-right: 2.2rem; color: var(--fg); }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: "+"; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.25rem; color: var(--muted); }
.faq-item[open] > summary::after { content: "−"; }
.faq-item[open] > summary { border-bottom: 1px solid var(--border); }
.faq-answer { padding: .5rem 1rem 1rem; color: var(--fg); }
.faq-answer code { background: var(--bg); border: 1px solid var(--border); padding: 0.1em 0.35em; border-radius: 3px; font-size: .92em; }
.faq-learn-more { display: inline-block; margin-top: .75rem; font-size: .9em; color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.faq-learn-more:hover { text-decoration: underline; color: var(--primary); }

.glossary-atoz { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1.5rem 0 2rem; padding: .75rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; position: sticky; top: 68px; z-index: 5; }
.glossary-atoz a, .glossary-atoz .disabled { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: 6px; font-weight: 600; font-size: .95rem; text-decoration: none; }
.glossary-atoz a { color: var(--primary-dark); background: var(--bg); border: 1px solid var(--border); }
.glossary-atoz a:hover { background: var(--accent); color: var(--primary-dark); text-decoration: none; }
.glossary-atoz .disabled { color: var(--muted); opacity: .35; cursor: not-allowed; }

.glossary-section { margin: 2.5rem 0; scroll-margin-top: 90px; }
.glossary-letter { display: inline-block; min-width: 3rem; padding: .25rem .75rem; margin: 0 0 1rem; background: var(--primary); color: #fff; border-radius: 6px; font-size: 1.5rem; text-align: center; }
.glossary-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .5rem .75rem; }
.glossary-list li { padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.glossary-list li a { color: var(--java-blue-dark); }
.glossary-list li a:hover { color: var(--primary-dark); }
.glossary-desc { color: var(--muted); font-size: .9em; }

.nav-download { background: var(--primary); color: #fff !important; padding: .45rem 1rem; border-radius: 6px; font-weight: 600; }
.nav-download:hover { background: var(--primary-dark); color: #fff !important; text-decoration: none; }

.download-featured { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; margin: 2rem 0; }
.download-featured-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; }
.download-featured-primary { background: linear-gradient(135deg, #fff6e6 0%, #ffe9c8 100%); border-color: var(--primary); }
.download-featured-badge { display: inline-block; background: var(--primary); color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-bottom: .5rem; align-self: flex-start; }
.download-featured-card h2 { margin: 0 0 .5rem; font-size: 1.35rem; color: var(--java-blue-dark); }
.download-featured-card p { color: var(--muted); flex: 1; margin: 0 0 1rem; font-size: .95rem; }
.download-cta { display: inline-block; padding: .55rem 1rem; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--java-blue-dark); font-weight: 600; text-decoration: none; text-align: center; }
.download-cta:hover { background: var(--accent); text-decoration: none; border-color: var(--primary); }
.download-cta-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.download-cta-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

.download-version-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0; }
.download-version-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--fg); transition: transform .1s ease, box-shadow .1s ease; }
.download-version-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; border-color: var(--primary); }
.download-version-card h3 { color: var(--java-blue-dark); margin: 0 0 .5rem; font-size: 1.2rem; }
.download-version-card .excerpt { font-size: .85rem; color: var(--muted); margin: 0; }

.download-vendor-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.download-vendor-table th, .download-vendor-table td { padding: .75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
.download-vendor-table th { background: var(--card-bg); font-weight: 600; }

.download-vendor-block { margin: 2.5rem 0; padding: 1.25rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.download-vendor-block h2 { margin-top: 0; color: var(--java-blue-dark); }
.download-warning { background: #fff3cd; border: 1px solid #ffe08a; border-left: 4px solid #f0b429; padding: .75rem 1rem; border-radius: 6px; color: #664d03; }

.download-button-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-top: 1rem; }
.download-btn { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--fg); transition: transform .1s ease, box-shadow .1s ease, border-color .1s ease; position: relative; }
.download-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; border-color: var(--primary); }
.download-btn-os { font-weight: 600; font-size: 1rem; color: var(--java-blue-dark); }
.download-btn-details { display: flex; align-items: baseline; gap: .5rem; }
.download-btn-details strong { color: var(--fg); }
.download-btn-format { color: var(--muted); font-size: .85rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.download-btn-note { color: var(--muted); font-size: .8rem; line-height: 1.4; margin-top: .25rem; }

.download-go { max-width: 760px; margin: 0 auto; padding: 1rem 0; }
.download-go-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.download-go-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.download-go-icon { font-size: 2.5rem; background: var(--primary); color: #fff; width: 3.5rem; height: 3.5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0; }
.download-go-header h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.download-go-sub { margin: 0; color: var(--muted); }
.download-go-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem 1.5rem; background: var(--bg); padding: 1rem; border-radius: 8px; margin: 0 0 1.25rem; border: 1px solid var(--border); }
.download-go-meta > div { display: flex; flex-direction: column; gap: .15rem; }
.download-go-meta dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; font-weight: 600; }
.download-go-meta dd { margin: 0; font-weight: 500; color: var(--fg); }
.download-go-note { background: var(--accent); padding: .75rem 1rem; border-radius: 6px; font-size: .9rem; color: var(--primary-dark); margin: 0 0 1.25rem; }
.download-go-timer { display: flex; align-items: center; gap: 1.25rem; margin: 1.5rem 0; padding: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.download-go-ring { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; flex-shrink: 0; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.download-go-fallback { font-size: .95rem; color: var(--muted); text-align: center; margin: 1rem 0; }
.download-go-fallback a { color: var(--primary-dark); font-weight: 600; }
.download-go-trust { background: var(--bg); border: 1px solid var(--border); border-left: 4px solid #4a8b3c; border-radius: 6px; padding: 1rem 1.25rem; margin: 1.5rem 0; }
.download-go-trust h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.download-go-trust ul { margin: .5rem 0 0; padding-left: 0; list-style: none; }
.download-go-trust li { margin: .25rem 0; font-size: .9rem; }
.download-go-related { margin-top: 1.5rem; }
.download-go-related h2 { font-size: 1.1rem; margin: 0 0 .5rem; }

@media (max-width: 768px) {
  .download-featured { grid-template-columns: 1fr; }
  .download-go-header { flex-direction: column; }
}

.faq-footer { margin: 3rem 0 1rem; padding: 1.5rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; text-align: center; }

/* ── Tools index page ─────────────────────────────────── */
.tools-hero {
  margin: -.5rem -1rem 2.5rem;
  padding: 2.5rem 1rem 2rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--card-bg) 70%);
  border-top: 3px solid var(--primary);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
}
.home-hero { padding-bottom: 2.5rem; }

/* Home hero: text + code split */
.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}
.hero-copy { min-width: 0; }
.hero-code {
  margin: 0;
  background: #1e293b;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px -8px rgba(20,40,63,.35), 0 4px 10px -4px rgba(20,40,63,.2);
  overflow: hidden;
  font-family: var(--font-mono);
  border: 1px solid #334155;
}
.hero-code-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .85rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}
.hero-code-bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #475569;
}
.hero-code-bar span:nth-child(1) { background: #ef4444; }
.hero-code-bar span:nth-child(2) { background: #f89820; }
.hero-code-bar span:nth-child(3) { background: #22c55e; }
.hero-code-bar em {
  margin-left: auto;
  font-style: normal;
  color: #94a3b8;
  font-size: .78rem;
  letter-spacing: .02em;
}
.hero-code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  background: transparent;
  color: #e2e8f0;
  font-size: .82rem;
  line-height: 1.55;
  overflow-x: auto;
  border: 0;
  border-radius: 0;
}
.hero-code pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; text-shadow: none; }
.hero-code .token.keyword,
.hero-code .token.boolean { color: #f89820; font-weight: 600; }
.hero-code .token.class-name { color: #93c5fd; }
.hero-code .token.string { color: #86efac; }
.hero-code .token.comment { color: #64748b; font-style: italic; }
.hero-code .token.function,
.hero-code .token.method { color: #fbbf24; }
.hero-code .token.number { color: #f472b6; }
.hero-code .token.punctuation { color: #cbd5e1; }
.hero-code .token.operator { color: #cbd5e1; }

@media (max-width: 820px) {
  .hero-split { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-code pre { font-size: .78rem; }
}
.tools-hero h1 { margin-bottom: .6rem; }
.tools-hero .lead { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0 0 1.25rem; }
.tools-stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.tools-stat {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .9rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: .82rem; font-weight: 600; color: var(--fg);
}
.tools-stat strong { color: var(--primary-dark); }

.tools-section {
  margin: 2rem 0 .75rem;
  display: flex; align-items: center; gap: .6rem;
}
.tools-section h2 {
  margin: 0; font-size: 1rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 700;
}
.tools-section-line {
  flex: 1; height: 1px; background: var(--border);
}

.tool-card { position: relative; overflow: hidden; }
.tool-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary);
  opacity: 0;
  transition: opacity .15s ease;
}
.tool-card:hover::before { opacity: 1; }
.tool-card a { display: flex; flex-direction: column; gap: .35rem; height: 100%; color: inherit; }
.tool-card-icon { font-size: 1.6rem; line-height: 1; }
.tool-card h3 { margin: 0; font-size: .95rem; }
.tool-card .excerpt { margin: 0; font-size: .85rem; flex: 1; }

.tool-card.cat-compile::before  { background: var(--primary); }
.tool-card.cat-convert::before  { background: #3b82f6; }
.tool-card.cat-encode::before   { background: #10b981; }
.tool-card.cat-datetime::before { background: #8b5cf6; }
.tool-card.cat-generate::before { background: #06b6d4; }

.tool-card.cat-compile:hover  { border-color: var(--primary); }
.tool-card.cat-convert:hover  { border-color: #3b82f6; }
.tool-card.cat-encode:hover   { border-color: #10b981; }
.tool-card.cat-datetime:hover { border-color: #8b5cf6; }
.tool-card.cat-generate:hover { border-color: #06b6d4; }

.tool-card h3.cat-compile  { color: var(--primary-dark); }
.tool-card h3.cat-convert  { color: #2563eb; }
.tool-card h3.cat-encode   { color: #059669; }
.tool-card h3.cat-datetime { color: #7c3aed; }
.tool-card h3.cat-generate { color: #0891b2; }

.tools-prose {
  max-width: 760px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.tools-prose h2 { font-size: 1.3rem; margin: 2rem 0 .75rem; }
.tools-prose h3 { font-size: 1rem; margin: 1.5rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.tools-prose p, .tools-prose ul, .tools-prose li { font-size: 1rem; }
.tools-prose ul { padding-left: 1.4rem; }
.tools-prose li { margin-bottom: .35rem; }
.tools-prose code {
  background: var(--card-bg); padding: 2px 6px;
  border-radius: 4px; font-size: .88em;
  font-family: var(--font-mono);
}

.tools-faq { margin: 2rem 0 0; }
.tools-faq-item { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.tools-faq-item h3 { margin: 0 0 .4rem; font-size: 1rem; color: var(--fg); }
.tools-faq-item p { margin: 0; color: var(--muted); font-size: .95rem; }
