/* ------------------------------------------------------------------
   Concrete Calculator — site styles
   Mobile-first. No framework. One file, deliberately small.
   ------------------------------------------------------------------ */

:root {
  --bg:        #ffffff;
  --surface:   #f4f4f2;
  --surface-2: #e9e9e5;
  --border:    #d5d5cf;
  --text:      #1b1d1f;
  --muted:     #55595e;
  --accent:    #b4460f;   /* 5.4:1 on white */
  --accent-dk: #8f370c;
  --ok:        #1c6b3f;
  --err:       #a3241a;
  --radius:    8px;
  --maxw:      44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #16181a;
    --surface:   #1f2225;
    --surface-2: #282c30;
    --border:    #3a3f44;
    --text:      #eef0f2;
    --muted:     #a8aeb5;
    --accent:    #ff8f52;   /* 7.1:1 on dark surface */
    --accent-dk: #ffa877;
    --ok:        #6bd39b;
    --err:       #ff8a7d;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-wrap: break-word;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }

h1, h2, h3 { line-height: 1.25; margin: 2rem 0 .6rem; font-weight: 700; }
h1 { font-size: 1.75rem; margin-top: 1.25rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.075rem; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .35rem; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dk); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Available to screen readers and search engines, not shown on screen.
   Never used to hide anything a user actually needs. */
.visually-hidden-heading {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg); color: var(--text);
  padding: .75rem 1rem; z-index: 10;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------------------------------- header / nav */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem 1rem; padding-top: .6rem; padding-bottom: .6rem;
}
.brand {
  font-weight: 700; font-size: 1.05rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--accent); }
.site-nav { margin-left: auto; }
.site-nav ul {
  display: flex; flex-wrap: wrap; gap: .25rem .9rem;
  list-style: none; margin: 0; padding: 0;
}
.site-nav a { font-size: .9375rem; text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }

/* ---------------------------------- calculator */

.lede { font-size: 1.075rem; color: var(--muted); margin-bottom: 1.25rem; }

.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1.5rem;
}

.field { margin-bottom: 1rem; }
.field:last-of-type { margin-bottom: 0; }

.field > label,
.fieldset-label {
  display: block;
  font-weight: 600;
  font-size: .9375rem;
  margin-bottom: .3rem;
}
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: .875rem; }

.input-row { display: flex; gap: .5rem; }
.input-row input { flex: 1 1 auto; min-width: 0; }
.input-row select { flex: 0 0 5.5rem; }

input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  min-height: 3rem;                 /* comfortable target with gloves on */
  padding: .55rem .7rem;
  font-size: 1.0625rem;             /* >=16px stops iOS zooming on focus */
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
select { appearance: none; background-image: none; padding-right: .5rem; }
input[aria-invalid="true"] { border-color: var(--err); border-width: 2px; }

.error {
  display: block; margin-top: .3rem;
  color: var(--err); font-size: .875rem; font-weight: 600;
}

.btn {
  display: inline-block; width: 100%;
  min-height: 3.25rem; padding: .75rem 1.25rem;
  font: 700 1.0625rem/1.2 inherit;
  color: #fff; background: var(--accent);
  border: 0; border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover { background: var(--accent-dk); }
@media (prefers-color-scheme: dark) { .btn { color: #16181a; } }

.btn--ghost {
  width: auto; min-height: 2.5rem; padding: .4rem .9rem;
  font-size: .9375rem; font-weight: 600;
  color: var(--accent); background: transparent;
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--accent-dk); }

.calc__actions { margin-top: 1.25rem; }

/* ---------------------------------- results */

.results {
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  padding: .5rem 1rem;
  margin-bottom: 1.5rem;
}
.results:focus { outline: none; }
.results__empty { color: var(--muted); margin: .75rem 0; }

.result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: .25rem .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.result:last-child { border-bottom: 0; }
.result__label { color: var(--muted); font-size: .9375rem; }
.result__value { font-size: 1.25rem; font-weight: 700; text-align: right; white-space: nowrap; }
.result__unit  { font-size: .9375rem; font-weight: 600; color: var(--muted); }
.result__note  { grid-column: 1 / -1; font-size: .8125rem; color: var(--muted); }

.result--primary .result__label { color: var(--text); font-weight: 600; font-size: 1rem; }
.result--primary .result__value { font-size: 2rem; color: var(--accent); }

.results__notes {
  margin: .5rem 0 .75rem; padding-left: 1.1rem;
  font-size: .875rem; color: var(--muted);
}

.results-actions { margin: -0.75rem 0 1.5rem; }

/* ---------------------------------- content */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem .9rem;
  margin: 1rem 0;
  background: var(--surface);
}
summary {
  cursor: pointer; font-weight: 600;
  padding: .65rem 0; min-height: 2.75rem;
  display: flex; align-items: center;
}
details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: .75rem; }

table {
  width: 100%; border-collapse: collapse;
  margin: 0 0 1rem; font-size: .9375rem;
}
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; }
.table-scroll { overflow-x: auto; }

.callout {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: .9rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
  font-size: .9375rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { display: block; margin-bottom: .25rem; }

.card-links { list-style: none; padding: 0; display: grid; gap: .6rem; }
.card-links a {
  display: block; padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none;
  font-weight: 600; color: var(--text);
}
.card-links a:hover { border-color: var(--accent); color: var(--accent); }
.card-links span { display: block; font-weight: 400; font-size: .875rem; color: var(--muted); }

/* ---------------------------------- ad slots
   Reserved space only. Fixed min-height so inserting an ad later cannot
   shift the page (protects CLS). Nothing here may sit above or beside
   the calculator inputs or results. */

.ad-slot {
  min-height: 280px;
  margin: 2rem 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted); font-size: .75rem; letter-spacing: .08em;
  text-transform: uppercase;
}
.ad-slot::before { content: "Advertisement"; }
.ad-slot--leaderboard { min-height: 100px; }

/* ---------------------------------- footer */

.site-footer {
  margin-top: 3rem; padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: .9375rem; color: var(--muted);
}
.site-footer ul {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin-bottom: .5rem; }

/* ---------------------------------- wider screens */

@media (min-width: 40rem) {
  h1 { font-size: 2.125rem; }
  .calc { padding: 1.5rem; }
  .calc__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .calc__grid .field--full { grid-column: 1 / -1; }
  .btn { width: auto; min-width: 14rem; }
  .result--primary .result__value { font-size: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .site-header, .site-nav, .ad-slot, .calc__actions, .results-actions, .site-footer { display: none; }
  .results { border-color: #000; }
}
