/* TEKNO — Engineering Made Simple */
:root {
  --blue: #0047AB;
  --blue-dark: #003580;
  --blue-soft: #E8F0FB;
  --text: #1A202C;
  --muted: #5A6472;
  --bg: #FFFFFF;
  --bg-alt: #F3F5F8;
  --border: #DDE2EA;
  --ok: #1E7B45;
  --err: #B42318;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Tahoma", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.container { width: min(1100px, 92%); margin: 0 auto; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 0; flex-wrap: wrap;
}
.logo {
  font-weight: 800; font-size: 1.5rem; letter-spacing: .06em;
  color: var(--blue); text-decoration: none;
}
.logo span { color: var(--text); font-weight: 500; font-size: .75rem; letter-spacing: .02em; display: block; margin-top: -4px; }
.nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--text); font-size: .95rem; }
.nav a[aria-current="page"] { color: var(--blue); font-weight: 600; }
.lang-switch {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  padding: .35rem .7rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: .9rem;
}

/* Hero */
.hero { background: var(--bg-alt); padding: 3.5rem 0 3rem; }
.hero h1 { font-size: 2.2rem; max-width: 18ch; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 60ch; }
.btn {
  display: inline-block; background: var(--blue); color: #fff; border: 0;
  padding: .7rem 1.2rem; border-radius: var(--radius); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn-secondary:hover { background: var(--blue-soft); }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #9DBDE8; outline-offset: 2px;
}

/* Sections & cards */
section { padding: 2.5rem 0; }
section + section { border-top: 1px solid var(--border); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; color: var(--text); display: block;
}
a.card:hover { border-color: var(--blue); text-decoration: none; }
.card h3 { color: var(--blue); margin-bottom: .3rem; }
.card p { color: var(--muted); font-size: .92rem; margin: 0; }
.tag {
  display: inline-block; font-size: .75rem; background: var(--blue-soft);
  color: var(--blue-dark); padding: .15rem .5rem; border-radius: 4px; margin-bottom: .4rem;
}

/* Search and filters */
.search-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search-row input[type="search"], .search-row select {
  flex: 1 1 220px; padding: .65rem .8rem; border: 1px solid var(--border);
  border-radius: var(--radius); font: inherit; background: #fff; color: var(--text);
}
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: .3rem .85rem; font: inherit; font-size: .9rem; cursor: pointer; color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.empty { color: var(--muted); padding: 1rem 0; }

/* Calculator page */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }
.calc-wrap { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .calc-wrap { grid-template-columns: 1.1fr 1fr; } }
.panel {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem;
}
.panel h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field-row { display: flex; gap: .5rem; }
.field-row input { flex: 1 1 6rem; min-width: 6rem; }
.field-row select { flex: 0 1 auto; min-width: 0; max-width: 50%; }
.field small { color: var(--muted); display: block; margin-top: .25rem; font-size: .82rem; }
input[type="number"], input[type="text"], select {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
input.invalid { border-color: var(--err); }
.field .error { color: var(--err); font-size: .85rem; margin-top: .25rem; display: none; }
.field .error.show { display: block; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.result {
  background: var(--blue-soft); border: 1px solid #B9CFEE; border-radius: var(--radius);
  padding: 1rem; margin-top: 1.2rem;
}
.result .value { font-size: 1.6rem; font-weight: 700; color: var(--blue-dark); word-break: break-word; }
.result .label { font-size: .85rem; color: var(--muted); }
.result .msg-error { color: var(--err); font-weight: 600; }
.result-placeholder { color: var(--muted); font-size: .95rem; }
.details h3 { font-size: .95rem; margin-top: 1rem; }
.formula, .steps {
  background: var(--bg-alt); border-radius: 6px; padding: .8rem 1rem;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; white-space: pre-wrap;
  overflow-x: auto; direction: ltr; text-align: left;
}
.assumptions { font-size: .9rem; color: var(--muted); }
.assumptions li { margin-bottom: .25rem; }
.copy-status { font-size: .85rem; color: var(--ok); margin-left: .4rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 2rem 0; margin-top: 2rem; font-size: .92rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.site-footer .muted { color: var(--muted); }
.pill-list { display: flex; gap: .5rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.pill-list li { font-size: .88rem; color: var(--muted); border: 1px dashed var(--border); padding: .2rem .6rem; border-radius: 4px; }

/* RTL adjustments */
[dir="rtl"] .nav { flex-direction: row-reverse; }
[dir="rtl"] .field-row { flex-direction: row-reverse; }
[dir="rtl"] .btn-row { flex-direction: row-reverse; }

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .hero h1 { font-size: 1.7rem; }
  .header-inner { justify-content: center; }
}

/* Visually hidden but available to screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
