/* =========================================================================
   samsungcalculator.com — main.css
   No web fonts, no frameworks, no runtime CSS. ~11 KB minified, one request.
   ========================================================================= */

:root {
  --ink:        #0d1420;
  --ink-2:      #33405a;
  --ink-3:      #66748e;
  --muted:      #5d6b84;
  --paper:      #f4f6f9;
  --panel:      #ffffff;
  --line:       #e2e7ef;
  --line-2:     #cfd7e3;
  --accent:     #1348c8;
  --accent-ink: #0d3494;
  --accent-bg:  #eaf0ff;
  --good:       #0b7a55;
  --good-bg:    #e6f6f0;
  --warn:       #94520a;
  --warn-bg:    #fdf3e2;
  --readout:    #101b2f;
  --readout-2:  #1b2b47;
  --lcd:        #7ef2c0;

  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 1px 2px rgba(13, 20, 32, .06), 0 4px 14px rgba(13, 20, 32, .05);
  --shadow-lg:  0 8px 30px rgba(13, 20, 32, .10);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1140px;
  --gap: 24px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.018em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.25rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.65rem); margin-top: 1.9em; }
h3 { font-size: 1.08rem; margin-top: 1.5em; }
p  { margin: 0 0 1.05em; }
ul, ol { margin: 0 0 1.05em; padding-left: 1.25em; }
li { margin-bottom: .35em; }
small { font-size: .82rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ header */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 62px; }

.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--ink); font-size: 1.06rem; letter-spacing: -.03em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  background: var(--readout); color: var(--lcd);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; font-weight: 700;
}
.logo-mark span { transform: translateY(-.5px); }

.main-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: var(--ink-2); font-size: .93rem; font-weight: 500;
  padding: 7px 11px; border-radius: var(--radius-sm);
}
.main-nav a:hover { background: var(--paper); text-decoration: none; color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-bg); }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 7px 10px; cursor: pointer; color: var(--ink); font-size: .9rem; font-weight: 600;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none; position: absolute; left: 0; right: 0; top: 62px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 10px 20px 16px; gap: 2px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 8px; }
}

/* ------------------------------------------------------------------ search */
.search-box { position: relative; }
.search-box input {
  width: 100%; font: inherit; font-size: .95rem;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6b84' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px 50%;
  color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 60;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 60vh; overflow-y: auto; padding: 6px; display: none;
}
.search-results.open { display: block; }
.search-results a {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 11px; border-radius: var(--radius-sm); color: var(--ink); font-size: .93rem;
}
.search-results a:hover, .search-results a.active { background: var(--accent-bg); text-decoration: none; }
.search-results .cat { font-size: .76rem; color: var(--muted); flex: none; }
.search-empty { padding: 14px; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------------- hero */
.hero { background: var(--panel); border-bottom: 1px solid var(--line); padding: 44px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 { margin-bottom: .45em; }
.hero .lede { font-size: 1.08rem; color: var(--ink-2); max-width: 46ch; margin-bottom: 1.4em; }
.hero .search-box { max-width: 520px; }
.hero-stats { display: flex; gap: 26px; margin-top: 20px; flex-wrap: wrap; }
.hero-stats div { font-size: .85rem; color: var(--muted); }
.hero-stats b { display: block; font-family: var(--mono); font-size: 1.35rem; color: var(--ink); font-weight: 700; letter-spacing: -.03em; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero { padding: 32px 0 30px; }
}

/* --------------------------------------------------------- readout (signature) */
.readout {
  background: var(--readout);
  background-image: linear-gradient(180deg, #16243d 0%, #101b2f 100%);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: #fff;
  box-shadow: var(--shadow);
}
.readout-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .13em;
  color: #8fa4c6; font-weight: 600; margin-bottom: 6px;
}
.readout-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem); font-weight: 700;
  color: var(--lcd); letter-spacing: -.02em; line-height: 1.1;
  overflow-wrap: anywhere;
}
.readout-value.small { font-size: clamp(1.1rem, .9rem + 1vw, 1.4rem); }
.readout-unit { color: #8fa4c6; font-size: .6em; margin-left: .25em; font-weight: 500; }
.readout-rows { margin-top: 16px; border-top: 1px solid var(--readout-2); }
.readout-rows div {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--readout-2); font-size: .9rem;
}
.readout-rows div:last-child { border-bottom: 0; }
.readout-rows dt, .readout-rows .k { color: #a8bade; }
.readout-rows .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: #fff; font-weight: 600; }
.readout-note { margin-top: 12px; font-size: .8rem; color: #8fa4c6; }
.readout-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.readout-actions button {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  background: rgba(255,255,255,.08); color: #dce6f7;
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.readout-actions button:hover { background: rgba(255,255,255,.16); }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.card + .card { margin-top: var(--gap); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.tool-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; color: var(--ink);
  transition: border-color .12s ease, transform .12s ease;
}
.tool-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.tool-card b { display: block; font-size: .97rem; font-weight: 650; margin-bottom: 3px; }
.tool-card span { font-size: .84rem; color: var(--muted); display: block; }

.cat-card { display: flex; flex-direction: column; height: 100%; }
.cat-card .count {
  font-family: var(--mono); font-size: .78rem; color: var(--accent);
  background: var(--accent-bg); padding: 2px 8px; border-radius: 20px; align-self: flex-start;
}
.cat-card ul { list-style: none; padding: 0; margin: 12px 0 0; }
.cat-card li { margin-bottom: 5px; font-size: .9rem; }

/* ------------------------------------------------------------- tool layout */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
@media (max-width: 1000px) { .tool-layout { grid-template-columns: 1fr; } }

.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 22px; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: .87rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .control { display: flex; align-items: stretch; }
.field input, .field select, .field textarea {
  font: inherit; font-size: .97rem; width: 100%; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel); min-width: 0;
}
.field input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.field textarea { min-height: 92px; resize: vertical; font-family: var(--mono); font-size: .9rem; line-height: 1.5; }
.field .unit {
  flex: none; display: grid; place-items: center; padding: 0 11px;
  background: var(--paper); border: 1px solid var(--line-2); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .84rem; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.field .control input:has(+ .unit), .field .control select:has(+ .unit) {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.field.error input, .field.error textarea { border-color: #c0392b; }
.field .err { color: #c0392b; font-size: .8rem; margin-top: 4px; }

.calc-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.btn {
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); padding: 9px 16px; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); text-decoration: none; }
.btn-ghost { background: var(--panel); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--paper); text-decoration: none; }

/* keypad (basic / scientific calculators) */
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.keypad.sci { grid-template-columns: repeat(5, 1fr); }
.keypad button {
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
  padding: 13px 4px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
}
.keypad button:active { transform: translateY(1px); }
.keypad button:hover { background: var(--paper); }
.keypad .op { background: var(--paper); color: var(--accent); }
.keypad .eq { background: var(--accent); color: #fff; border-color: var(--accent); }
.keypad .fn { font-size: .82rem; color: var(--ink-2); }
.keypad .clear { color: #c0392b; }
@media (max-width: 420px) { .keypad button { padding: 12px 2px; font-size: .95rem; } .keypad.sci { gap: 5px; } }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .89rem; background: var(--panel); }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--paper); font-weight: 650; color: var(--ink-2); position: sticky; top: 0; }
tbody td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
tbody td:first-child { font-family: var(--sans); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.year-row { background: var(--paper); font-weight: 600; }

/* ------------------------------------------------------------------- misc */
.breadcrumbs { font-size: .84rem; color: var(--muted); padding: 14px 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li::after { content: "/"; margin-left: 6px; color: var(--line-2); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--muted); }

.eyebrow {
  font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chips li {
  font-size: .8rem; color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 11px; margin: 0;
}

.formula {
  font-family: var(--mono); font-size: .92rem; background: var(--paper);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 13px 15px; overflow-x: auto;
  color: var(--ink-2);
}

.note {
  background: var(--warn-bg); border: 1px solid #f0dcb8; border-radius: var(--radius-sm);
  padding: 12px 15px; font-size: .88rem; color: var(--warn);
}
.note.info { background: var(--accent-bg); border-color: #c9d8fb; color: var(--accent-ink); }
.note.good { background: var(--good-bg); border-color: #bce6d6; color: var(--good); }

details.faq { border-bottom: 1px solid var(--line); }
details.faq:last-of-type { border-bottom: 0; }
details.faq summary {
  cursor: pointer; padding: 14px 28px 14px 0; font-weight: 600; position: relative; list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 12px;
  font-family: var(--mono); font-size: 1.2rem; color: var(--accent); font-weight: 400;
}
details.faq[open] summary::after { content: "\2013"; }
details.faq p { margin: 0 0 14px; color: var(--ink-2); }

.steps { list-style: none; counter-reset: step; padding: 0; }
.steps li {
  counter-increment: step; position: relative; padding-left: 38px; margin-bottom: 13px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 25px; height: 25px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  display: grid; place-items: center;
}

.sidebar { position: sticky; top: 80px; }
.sidebar .card { padding: 18px; }
.sidebar h2, .sidebar h3 { font-size: .95rem; margin-top: 0; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 7px; font-size: .9rem; }
@media (max-width: 1000px) { .sidebar { position: static; } }

.section { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

.post-card { display: flex; flex-direction: column; gap: 6px; }
.post-card .meta { font-size: .78rem; color: var(--muted); font-family: var(--mono); }
.post-card h3 { margin: 0; font-size: 1.02rem; }
.post-card p { margin: 0; font-size: .88rem; color: var(--muted); }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 2em; }
.prose ul li { margin-bottom: .4em; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 8px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel); font-size: .9rem; color: var(--ink-2);
}
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

.alpha-nav { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 22px; }
.alpha-nav a {
  font-family: var(--mono); font-size: .85rem; font-weight: 600;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
}

.embed-code {
  font-family: var(--mono); font-size: .82rem; background: var(--readout); color: #dbe6f8;
  border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; white-space: pre-wrap;
  word-break: break-all; margin: 0;
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  background: var(--panel); border-top: 1px solid var(--line);
  margin-top: 56px; padding: 40px 0 26px; font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 30px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: var(--ink-2); }
.footer-bottom {
  border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: .84rem;
}

/* print: keep the result, drop the chrome */
@media print {
  .site-header, .site-footer, .sidebar, .calc-actions, .readout-actions, .breadcrumbs { display: none; }
  body { background: #fff; }
  .readout { background: #fff; color: #000; border: 1px solid #000; }
  .readout-value { color: #000; }
}
