/* Nasıl Hesaplarım: kareli defter, tükenmez mavisi, kırmızı kalem. */

@font-face {
  font-family: 'Atkinson';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/atkinson-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/atkinson-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+A720-A7FF;
}

:root {
  --paper: #fafbfc;
  --sheet: #ffffff;
  --grid: #dce3ec;
  --grid-soft: #edf1f6;
  --ink: #1b2430;
  --pencil: #5b6675;
  --pen: #2346a8;
  --pen-soft: #e3e9f8;
  --pen-fg: #ffffff;
  --red: #c62f2f;
  --red-soft: #fbeaea;
  --field: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121a2b;
    --sheet: #172036;
    --grid: #2a3652;
    --grid-soft: #1d2740;
    --ink: #e6ebf2;
    --pencil: #9aa6b8;
    --pen: #8fb0ff;
    --pen-soft: #22305a;
    --pen-fg: #0f1730;
    --red: #ff8a80;
    --red-soft: #3a1f26;
    --field: #0f1626;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* hidden niteliği, display tanımlayan sınıflardan her zaman üstün gelsin */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 'Atkinson', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--pen);
  accent-color: var(--pen);
}
::selection { background: var(--pen-soft); color: var(--ink); }
a { color: var(--pen); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: 42rem; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-bottom: 56px; }

/* Üst ve alt */
header.site .wrap { display: flex; align-items: center; min-height: 56px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); font-weight: 700; text-decoration: none; letter-spacing: -0.01em;
}
.brand svg { width: 22px; height: 22px; flex: none; }
footer.site { border-top: 1px solid var(--grid); font-size: 0.9375rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 18px; padding-bottom: 28px; }
footer.site a { color: var(--pencil); text-decoration: none; padding: 6px 0; }
footer.site a:hover { color: var(--ink); text-decoration: underline; }

/* Yazı */
h1 {
  font-size: 1.75rem; line-height: 1.2; font-weight: 700;
  letter-spacing: -0.02em; margin: 6px 0 10px; text-wrap: balance;
}
h2 { font-size: 1.1875rem; line-height: 1.3; font-weight: 700; margin: 40px 0 10px; letter-spacing: -0.01em; }
p, ul, table { margin: 0 0 14px; }
ul { padding-left: 1.1em; }
li { margin-bottom: 8px; padding-left: 2px; }
li::marker { color: var(--pencil); }
.crumb { font-size: 0.9375rem; color: var(--pencil); margin: 12px 0 0; }
.crumb a { color: var(--pencil); }
.lead { color: var(--pencil); margin-bottom: 22px; max-width: 62ch; }
section p, section ul { max-width: 65ch; }

/* Hesap kâğıdı: sayfadaki tek iddialı öğe */
.calc {
  --sq: 22px;
  margin: 0 -4px;
  padding: 18px 16px 18px;
  border: 1px solid var(--grid);
  border-radius: 14px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-soft) 1px, transparent 1px);
  background-size: var(--sq) var(--sq);
  background-position: -1px -1px;
}
.fields { display: grid; gap: 16px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label {
  display: block; font-weight: 700; font-size: 0.9375rem; margin-bottom: 6px;
}
.opt { font-weight: 400; color: var(--pencil); }
.box { position: relative; }
.box input {
  width: 100%;
  height: 52px;
  padding: 0 64px 0 14px;
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--grid);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 120ms ease-out;
}
.box input::placeholder { color: var(--pencil); font-weight: 400; }
.box input:hover { border-color: color-mix(in srgb, var(--grid) 40%, var(--pencil)); }
.box input:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.box input[aria-invalid="true"] { border-color: var(--red); }
.box input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--red-soft); }
.box .unit {
  position: absolute; right: 14px; top: 0; bottom: 0;
  display: flex; align-items: center;
  color: var(--pencil); font-size: 0.9375rem; pointer-events: none;
}
.hint { font-size: 0.875rem; color: var(--pencil); margin: 6px 0 0; line-height: 1.45; }
.err { font-size: 0.9375rem; color: var(--red); margin: 6px 0 0; font-weight: 600; line-height: 1.4; }

.calc button {
  width: 100%;
  height: 52px;
  margin-top: 20px;
  font: inherit; font-weight: 700; font-size: 1.0625rem;
  color: var(--pen-fg);
  background: var(--pen);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 120ms ease-out, transform 80ms ease-out;
}
.calc button:hover { filter: brightness(1.08); }
.calc button:active { transform: scale(0.985); }

/* Sonuç: kâğıda tükenmezle yazılmış gibi */
.result { margin-top: 22px; padding-top: 16px; border-top: 1.5px dashed var(--grid); scroll-margin-bottom: 24px; }
.result dl { margin: 0; }
.result .row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 7px 0; }
.result dt { color: var(--pencil); }
.result dd { margin: 0; text-align: right; font-weight: 600; }
.result dd .unit { margin-left: 0.3em; }
.result .row.main { display: block; padding: 0 0 8px; }
.result .row.main dt { color: var(--ink); font-weight: 700; font-size: 0.9375rem; }
.result .row.main dd {
  text-align: left; color: var(--pen);
  font-size: 2.75rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em;
}
.result .row.main dd.long { font-size: 1.75rem; line-height: 1.2; }
.result .row.main .unit { font-size: 1.125rem; font-weight: 600; letter-spacing: 0; margin-left: 0.25em; }
.result .row + .row:not(.main) { border-top: 1px solid var(--grid-soft); }
.result .row.main + .row { border-top: 0; }
.ink { animation: ink 520ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes ink {
  from { clip-path: inset(0 100% 0 0); opacity: 0.4; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ink { animation: none; }
  .calc button, .box input { transition: none; }
}

/* Açıklama bölümleri */
.formula {
  display: inline-block;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--pen-soft);
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.5;
}
table.ex { border-collapse: collapse; width: 100%; max-width: 30rem; }
table.ex th, table.ex td { border-bottom: 1px solid var(--grid); padding: 9px 0; font-weight: 400; vertical-align: top; }
table.ex th { text-align: left; color: var(--pencil); padding-right: 16px; }
table.ex td { text-align: right; font-weight: 600; }
.sources { font-size: 0.9375rem; color: var(--pencil); }
.stamp { margin-top: 40px; font-size: 0.875rem; color: var(--pencil); }

/* Ana sayfa */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.home-intro { margin: 28px 0 8px; }
.home-intro h1 { font-size: 2rem; margin-bottom: 8px; }
.home-intro .lead { margin-bottom: 18px; }

.search {
  margin: 0 -4px;
  padding: 14px;
  border: 1px solid var(--grid);
  border-radius: 14px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-soft) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -1px -1px;
}
.search-box { position: relative; }
.search-box svg { position: absolute; left: 14px; top: 15px; width: 22px; height: 22px; color: var(--pencil); pointer-events: none; }
.search-box input {
  width: 100%; height: 52px; padding: 0 14px 0 46px;
  font-family: inherit; font-size: 1.0625rem; color: var(--ink);
  background: var(--field); border: 1.5px solid var(--grid); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
}
.search-box input::placeholder { color: var(--pencil); }
.search-box input:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-results { list-style: none; margin: 8px 0 0; padding: 0; }
.search-results li { margin: 0; padding: 0; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.search-results li[aria-selected="true"] a, .search-results a:hover { background: var(--pen-soft); }
.search-results .t { display: block; font-weight: 700; }
.search-results .d { display: block; font-size: 0.875rem; color: var(--pencil); }
.search-empty { margin: 10px 2px 0; font-size: 0.9375rem; color: var(--pencil); }

.cats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cats li { margin: 0; padding: 0; }
.cats a {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px;
  align-items: center; height: 100%; padding: 14px 12px;
  border: 1px solid var(--grid); border-radius: 12px; background: var(--field);
  color: var(--ink); text-decoration: none;
  transition: border-color 120ms ease-out;
}
.cats a:hover { border-color: var(--pen); }
.cats svg { grid-row: span 2; width: 28px; height: 28px; color: var(--pen); }
.cats .ad { font-weight: 700; font-size: 0.9375rem; line-height: 1.25; }
.cats .say { font-size: 0.8125rem; color: var(--pencil); }

.recent { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--grid); }
.recent li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.recent a { font-weight: 600; text-decoration: none; color: var(--ink); }
.recent a:hover { color: var(--pen); text-decoration: underline; }
.recent .tarih { flex: none; font-size: 0.875rem; color: var(--pencil); }

.all { margin-top: 8px; }
.index-group { scroll-margin-top: 16px; }
.index-group h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; margin: 28px 0 4px; color: var(--pencil); }
.index-group h3 svg { width: 20px; height: 20px; }
.index { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--grid); }
.index li { margin: 0; padding: 0; border-bottom: 1px solid var(--grid); }
.index a { display: block; padding: 14px 0; text-decoration: none; color: var(--ink); }
.index a:hover .t { color: var(--pen); text-decoration: underline; }
.index .t { display: block; font-weight: 700; color: var(--ink); }
.index .d { display: block; color: var(--pencil); font-size: 0.9375rem; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) { .cats a { transition: none; } }

.draft { margin: 0; padding: 6px 16px; background: var(--red); color: #fff; font-size: 0.875rem; text-align: center; }

@media (min-width: 640px) {
  h1 { font-size: 2.125rem; }
  .home-intro h1 { font-size: 2.5rem; }
  .search { margin: 0; padding: 18px; }
  .cats { grid-template-columns: repeat(3, 1fr); }
  .calc { margin: 0; padding: 26px 26px 24px; }
  .calc button { width: auto; padding: 0 32px; }
  main { padding-bottom: 72px; }
}

/* İki ya da üç seçenekli düğme grubu (MÖ/MS gibi) */
.choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice legend { padding: 0; font-weight: 700; font-size: 0.9375rem; margin-bottom: 6px; }
.seg {
  display: flex; height: 52px; padding: 4px; gap: 4px;
  background: var(--grid-soft); border: 1.5px solid var(--grid); border-radius: 10px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; font-weight: 600; color: var(--pencil); cursor: pointer;
  transition: background-color 120ms ease-out, color 120ms ease-out;
  -webkit-user-select: none; user-select: none;
}
.seg input:checked + label { background: var(--field); color: var(--pen); box-shadow: 0 1px 2px rgba(27, 36, 48, 0.12); }
.seg input:focus-visible + label { outline: 3px solid var(--pen); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .seg label { transition: none; } }

/* Açılır liste: alanlarla aynı görünüm, sağda ok */
.box select {
  width: 100%; height: 52px; padding: 0 40px 0 14px;
  font-family: inherit; font-size: 1.0625rem; font-weight: 600; color: var(--ink);
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235b6675' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  border: 1.5px solid var(--grid); border-radius: 10px;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.box select:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }

/* Hazır değerler tablosu: dar ekranda yatay kayar, sayfayı taşırmaz */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; }
table.ref { border-collapse: collapse; width: 100%; min-width: 20rem; }
table.ref th, table.ref td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
table.ref thead th { font-size: 0.875rem; color: var(--pencil); font-weight: 600; vertical-align: bottom; white-space: normal; }
table.ref tbody th { text-align: left; font-weight: 600; }
table.ref thead th:first-child { text-align: left; }
table.ref tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--grid-soft) 55%, transparent); }
.pair-wrap > .hint { margin-top: 6px; }

/* Benzer hesaplamalar */
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.related li { margin: 0; padding: 0; }
.related a {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: start;
  padding: 14px; border: 1px solid var(--grid); border-radius: 12px; background: var(--field);
  color: var(--ink); text-decoration: none; transition: border-color 120ms ease-out;
}
.related a:hover { border-color: var(--pen); }
.related svg { grid-row: span 2; width: 24px; height: 24px; color: var(--pen); margin-top: 1px; }
.related .t { font-weight: 700; line-height: 1.3; }
.related .d { font-size: 0.875rem; color: var(--pencil); margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .related a { transition: none; } }
