/* ===== Design tokens ===== */
:root {
  --bg: #0b0e14;
  --bg-panel: #12161f;
  --bg-panel-raised: #171c28;
  --border: #232838;
  --border-bright: #343d54;
  --text: #eef1f6;
  --text-muted: #8891a7;
  --text-faint: #565f78;
  --accent: #f2a93b;
  --accent-dim: #a87729;
  --accent-cyan: #4fd1c5;
  --danger: #f2637b;
  --success: #4fd18f;

  --font-display: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --max-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* subtle grain/scanline texture behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 3px;
  opacity: 0.5;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(11, 14, 20, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.lang-switch {
  display: flex;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.lang-switch a {
  padding: 5px 9px;
  border-radius: 4px;
  color: var(--text-faint);
}

.lang-switch a.active {
  background: var(--bg-panel-raised);
  color: var(--accent);
  text-decoration: none;
}

.lang-switch a:hover {
  text-decoration: none;
  color: var(--text);
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo .prompt {
  color: var(--accent);
}

.logo .cursor {
  display: inline-block;
  width: 9px;
  height: 18px;
  background: var(--accent);
  margin-left: 4px;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.site-nav {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.site-nav a {
  color: var(--text-muted);
}
.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ===== Mobile: scrollable nav instead of wrapping ===== */
@media (max-width: 680px) {
  .site-header .wrap {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .site-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 20px;
    padding-bottom: 2px;
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    flex-shrink: 0;
  }

  .lang-switch {
    flex-shrink: 0;
  }
}

/* ===== Prompt label (signature motif) ===== */
.prompt-label {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.prompt-label::before {
  content: ">";
  color: var(--accent-dim);
}

/* ===== Hero ===== */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  max-width: 720px;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero p.lede {
  color: var(--text-muted);
  font-size: 18px;
  max-width: 560px;
  margin: 0 0 40px;
}

/* ===== Tool cards / grid ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.tool-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: block;
}

.tool-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
  text-decoration: none;
}

.tool-card .tool-icon {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 10px;
  display: block;
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
}

.tool-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Sections ===== */
section {
  padding: 56px 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.section-sub {
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 580px;
}

/* ===== Tool page layout ===== */
.tool-header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-faint); }

.tool-header h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 34px);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.tool-header p {
  color: var(--text-muted);
  max-width: 620px;
  margin: 0;
}

.tool-body {
  padding: 36px 0 64px;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 14px;
  resize: vertical;
}

textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-dim);
}

textarea {
  min-height: 220px;
  line-height: 1.5;
}

.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 760px) {
  .io-grid { grid-template-columns: 1fr; }
}

.btn-row {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}

button, .btn {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--bg-panel-raised);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:hover {
  border-color: var(--accent-dim);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #14110a;
}

button.primary:hover {
  background: #ffbc5c;
}

.status-msg {
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin-top: 10px;
  min-height: 18px;
}
.status-msg.ok { color: var(--success); }
.status-msg.err { color: var(--danger); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-mono);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--text-faint);
}

/* ===== ad slot placeholder ===== */
.ad-slot {
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 14px;
  margin: 28px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-inline {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 32px;
  max-width: 620px;
}

/* ===== Calculator form elements ===== */
.field-row {
  margin-bottom: 16px;
}

.field-row label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.field-row .hint-inline {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 4px;
}

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

@media (max-width: 600px) {
  .field-grid { grid-template-columns: 1fr; }
}

.toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.toggle-row button {
  flex: 1;
  background: var(--bg);
}

.toggle-row button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #14110a;
}

.result-panel {
  background: var(--bg-panel-raised);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}

.result-big {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.result-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.breakdown-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.breakdown-table td:last-child {
  text-align: right;
  color: var(--text);
}

.breakdown-table tr:last-child td {
  border-bottom: none;
  padding-top: 12px;
  font-weight: 700;
  color: var(--text);
}

.disclaimer-box {
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 24px;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 620px;
}

/* ===== Site guide / overview section ===== */
.site-intro {
  max-width: 760px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.75;
}

.site-intro p {
  margin: 0 0 16px;
}

.site-intro strong {
  color: var(--text);
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.guide-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: var(--bg-panel);
}

.guide-item a {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}

.guide-item a:hover {
  color: var(--accent);
}

.guide-item a::after {
  content: " →";
  color: var(--accent);
}

.guide-item p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ===== Converter tool ===== */
.converter-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 8px;
}

.converter-swap {
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent);
  cursor: pointer;
  margin-bottom: 2px;
}

.converter-swap:hover {
  border-color: var(--accent);
}

@media (max-width: 560px) {
  .converter-row { grid-template-columns: 1fr; }
  .converter-swap { justify-self: center; transform: rotate(90deg); }
}

.unit-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 12px;
  margin-top: 8px;
}

.converter-result {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  margin-top: 20px;
}

.converter-result .value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

.quick-ref {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.quick-ref div {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
