/*
Theme Name: IBAN Rechnerr
Theme URI: https://iban-rechnerr.de
Author: IBAN Rechnerr Team
Description: Mobile-first IBAN calculator WordPress theme with full Customizer support
Version: 2.0.0
License: GNU General Public License v2 or later
Text Domain: iban-rechnerr
*/

/* ================================================================
   CSS CUSTOM PROPERTIES
   ================================================================ */
:root {
  --blue:        #1565c0;
  --blue-dark:   #0d47a1;
  --blue-light:  #e3f2fd;
  --blue-mid:    #1976d2;
  --accent:      #f57c00;
  --accent-lt:   #fff3e0;
  --green:       #2e7d32;
  --green-lt:    #e8f5e9;
  --red:         #c62828;
  --red-lt:      #ffebee;
  --bg:          #eef4fc;
  --card:        #ffffff;
  --border:      #c5d9f0;
  --text:        #1a237e;
  --body:        #263238;
  --muted:       #546e7a;
  --footer-bg:   #0d47a1;
  --shadow:      0 2px 10px rgba(21,101,192,.10);
  --shadow-lg:   0 6px 24px rgba(21,101,192,.16);
  --r:           10px;
  --rs:          5px;
  --tr:          0.22s ease;
  --max:         1160px;
  --font:        'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-h:      'Source Serif 4', Georgia, serif;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.72;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--blue-dark); text-decoration: underline; }
h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-h);
  font-weight: 700;
  line-height: 1.28;
  color: var(--text);
}
code {
  font-family: var(--font-mono);
  background: #e8f4fd;
  padding: .1rem .35rem;
  border-radius: 3px;
  font-size: .85em;
}

/* ================================================================
   SITE WRAPPER
   ================================================================ */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

/* ================================================================
   HEADER — MOBILE-FIRST
   ================================================================ */
.site-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 14px rgba(0,0,0,.25);
}

/* Top row: logo + hamburger */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  max-width: var(--max);
  margin: 0 auto;
  gap: .75rem;
}

/* Logo */
.site-branding {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
  flex-shrink: 1;
}
.site-logo-box {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.32);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 900; font-size: .56rem;
  color: #fff; line-height: 1.2; text-align: center;
  flex-shrink: 0;
}
.site-name-wrap { min-width: 0; }
.site-name {
  font-family: var(--font-h);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff !important;
  display: block;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none !important;
}
.site-desc {
  font-size: .68rem;
  color: rgba(255,255,255,.72);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hamburger */
.menu-toggle {
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 7px;
  width: 42px; height: 42px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 0;
}
.menu-toggle .bar {
  display: block;
  width: 20px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--tr);
}
.menu-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav panel */
.main-nav {
  display: none;
  background: var(--blue-dark);
  border-top: 1px solid rgba(255,255,255,.12);
}
.main-nav.is-open { display: block; }

.nav-menu { list-style: none; padding: .4rem 0 .8rem; }
.nav-menu li a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem 1.2rem;
  color: rgba(255,255,255,.92);
  font-weight: 700;
  font-size: .9rem;
  transition: background var(--tr);
  text-decoration: none;
}
.nav-menu li a:hover,
.nav-menu .current-menu-item > a {
  background: rgba(255,255,255,.14);
  color: #fff;
  text-decoration: none;
}
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 5px;
  font-size: .85rem;
  flex-shrink: 0;
}

/* Sub-nav */
.sub-nav {
  background: #fff;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav-inner {
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: .32rem .85rem;
  gap: .05rem;
  max-width: var(--max);
  margin: 0 auto;
}
.sub-nav a {
  font-size: .78rem;
  color: var(--blue);
  padding: .22rem .48rem;
  border-radius: 4px;
  font-weight: 700;
  transition: background var(--tr);
  flex-shrink: 0;
}
.sub-nav a:hover { background: var(--blue-light); text-decoration: none; }
.sub-nav .sep { color: #ccc; margin: 0 .1rem; flex-shrink: 0; }

/* Desktop nav — override mobile */
@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .main-nav {
    display: block !important;
    background: transparent;
    border-top: 1px solid rgba(255,255,255,.15);
  }
  .nav-menu {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem;
    padding: .3rem .9rem;
    max-width: var(--max);
    margin: 0 auto;
  }
  .nav-menu li a {
    padding: .42rem .82rem;
    font-size: .8rem;
    border-radius: 5px;
  }
}

/* ================================================================
   PAGE LAYOUT — sidebar hidden on mobile/tablet
   ================================================================ */
.page-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem .85rem 2rem;
  max-width: var(--max);
  margin: 0 auto;
}

/* Sidebar is hidden by default (mobile-first) */
.sidebar { display: none; }

@media (min-width: 1060px) {
  .page-layout {
    flex-direction: row;
    gap: 1.25rem;
    padding: 1.25rem 1rem 2.5rem;
    align-items: flex-start;
  }
  .sidebar {
    display: block;
    width: 210px;
    flex-shrink: 0;
  }
  .content-area { flex: 1; min-width: 0; }
}

/* ================================================================
   SIDEBAR WIDGET
   ================================================================ */
.sidebar-widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: .9rem;
}
.sidebar-widget h2 {
  font-size: .95rem;
  color: var(--blue);
  margin-bottom: .65rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}
.sidebar-widget ul { list-style: none; }
.sidebar-widget li {
  padding: .28rem 0;
  font-size: .86rem;
  border-bottom: 1px dotted var(--border);
}
.sidebar-widget li:last-child { border-bottom: none; }
.sidebar-widget li a { color: var(--blue); }
.badge-pill {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  padding: .07rem .38rem;
  border-radius: 20px;
  margin-left: .25rem;
  vertical-align: middle;
}
.pro-cta {
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 2px solid var(--border);
  font-size: .86rem;
}
.pro-cta a { font-weight: 700; }

/* ================================================================
   CONTENT AREA & CALC GRID
   ================================================================ */
.content-area { display: flex; flex-direction: column; gap: 1rem; }

/* Mobile: single column always */
.calc-grid, .bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
/* Tablet+: two columns */
@media (min-width: 640px) {
  .calc-grid  { grid-template-columns: 1fr 1fr; }
  .bottom-grid { grid-template-columns: 1fr 1fr; }
}

/* ================================================================
   CALC CARDS
   ================================================================ */
.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.calc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #42a5f5);
}
.calc-card h1,
.calc-card h2 {
  font-size: 1.15rem;
  color: var(--blue);
  margin-bottom: .8rem;
  padding-bottom: .42rem;
  border-bottom: 2px dashed var(--border);
}

/* ================================================================
   FORMS — touch-friendly
   ================================================================ */
.form-group { margin-bottom: .85rem; }
.form-group label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .3rem;
  color: var(--text);
}
.form-control {
  width: 100%;
  /* Tall enough for easy tapping (min 44px) */
  padding: .65rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  font-family: var(--font);
  font-size: 1rem;       /* ≥16px prevents iOS zoom */
  background: #fafcff;
  color: var(--body);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--tr), box-shadow var(--tr);
  line-height: 1.4;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.15);
}
.iban-input {
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1rem;
}
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%231565c0' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
}
.hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .4rem;
  line-height: 1.5;
}

/* ================================================================
   BUTTONS — min 44px tap target
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  padding: .55rem 1.15rem;
  border: none;
  border-radius: var(--rs);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--tr);
  text-decoration: none;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.btn:active { transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-dark), #07285e); color: #fff; }
.btn-block { width: 100%; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   RESULT BOX
   ================================================================ */
.result-box {
  margin-top: 1rem;
  padding: .9rem 1.05rem;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: #f8fbff;
  display: none;
  animation: fadeUp .25s ease;
}
.result-box.show { display: block; }
.result-box.valid-result { border-color: var(--green); background: var(--green-lt); }
.result-box.error-result { border-color: var(--red); background: var(--red-lt); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.result-status { display: flex; align-items: center; gap: .45rem; font-weight: 800; font-size: .95rem; margin-bottom: .6rem; }
.result-status.ok { color: var(--green); }
.result-status.err { color: var(--red); }
.result-iban {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: .45rem .72rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: .07em;
  margin-bottom: .65rem;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .42rem 1rem;
}
@media (max-width: 380px) { .result-grid { grid-template-columns: 1fr; } }
.result-item .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.result-item .val { font-weight: 700; font-size: .86rem; font-family: var(--font-mono); }

/* ================================================================
   GUARANTEE BOX
   ================================================================ */
.guarantee-box {
  background: linear-gradient(135deg, #fffbeb, #fff8e1);
  border: 1.5px solid #f9a825;
  border-radius: var(--r);
  padding: .9rem 1.05rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-top: 1rem;
}
.guarantee-box h3 { font-size: .9rem; color: #6d4c00; margin-bottom: .18rem; }
.guarantee-box p  { font-size: .82rem; color: #5d3c00; margin: 0; }

/* ================================================================
   ARTICLE / CONTENT
   ================================================================ */
.article-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.article-wrap h1 { font-size: clamp(1.25rem, 4vw, 1.75rem); margin-bottom: .45rem; }
.article-intro { font-size: .97rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.68; }
.article-wrap h2 {
  font-size: 1.2rem;
  color: var(--blue);
  border-bottom: 2px solid var(--border);
  padding-bottom: .32rem;
  margin: 1.4rem 0 .65rem;
}
.article-wrap h3 { font-size: 1rem; color: var(--blue-dark); margin: 1rem 0 .42rem; }
.article-wrap p  { margin-bottom: .85rem; font-size: .95rem; }
.article-wrap ul,
.article-wrap ol { padding-left: 1.4rem; margin-bottom: .85rem; font-size: .95rem; }
.article-wrap li { margin-bottom: .3rem; }
.article-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: .84rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.article-wrap th { background: var(--blue); color: #fff; padding: .5rem .85rem; text-align: left; white-space: nowrap; }
.article-wrap td { padding: .42rem .85rem; border-bottom: 1px solid var(--border); }
.article-wrap tr:nth-child(even) td { background: #f4f8fd; }
.infobox {
  background: #e8f4fd;
  border-left: 4px solid var(--blue);
  padding: .82rem 1rem;
  border-radius: 0 var(--rs) var(--rs) 0;
  margin: 1rem 0;
  font-size: .9rem;
}
.infobox p { margin: 0; }

/* TOC */
.toc {
  background: #f5f9ff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .95rem 1.1rem;
  margin-bottom: 1.3rem;
}
.toc strong { display: block; margin-bottom: .45rem; color: var(--blue-dark); font-size: .9rem; }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: .86rem; line-height: 1.85; }

/* ================================================================
   RELATED ARTICLES
   ================================================================ */
.related-section { margin-top: 1.5rem; }
.related-section h2 {
  font-size: 1.05rem;
  color: var(--body);
  margin-bottom: .8rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}
@media (min-width: 560px)  { .related-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px)  { .related-grid { grid-template-columns: repeat(3, 1fr); } }

.rel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--tr), transform var(--tr);
  text-decoration: none;
}
.rel-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.rel-tag {
  font-size: .67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue);
  background: var(--blue-light);
  padding: .12rem .46rem;
  border-radius: 20px;
  width: fit-content;
  display: inline-block;
}
.rel-card h3 { font-size: .9rem; line-height: 1.35; color: var(--text); }
.rel-card p  { font-size: .8rem; color: var(--muted); margin: 0; flex: 1; }
.rel-link    { font-size: .78rem; font-weight: 700; color: var(--blue); margin-top: .15rem; }

/* ================================================================
   FAQ
   ================================================================ */
.faq-item { border: 1.5px solid var(--border); border-radius: var(--r); margin-bottom: .6rem; overflow: hidden; }
.faq-q {
  padding: .9rem 1.1rem;
  background: #f4f8ff;
  cursor: pointer;
  font-weight: 700;
  font-size: .92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  color: var(--blue-dark);
  user-select: none;
  -webkit-user-select: none;
  /* min tap target */
  min-height: 44px;
}
.faq-q::after { content: '＋'; font-size: 1rem; color: var(--blue); flex-shrink: 0; }
.faq-item.open .faq-q { background: var(--blue-light); }
.faq-item.open .faq-q::after { content: '－'; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .32s ease, padding .32s ease;
  padding: 0 1.1rem;
  font-size: .91rem;
  color: var(--body);
}
.faq-item.open .faq-a { max-height: 600px; padding: .95rem 1.1rem; }
.faq-a p  { margin-bottom: .5rem; }
.faq-a ul { padding-left: 1.3rem; }

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,.8);
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: 2rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .7rem 1.3rem;
  margin-bottom: .65rem;
}
.footer-links a { color: rgba(255,255,255,.8); font-size: .86rem; font-weight: 600; }
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-copy { font-size: .78rem; opacity: .65; }

/* ================================================================
   UTILITY
   ================================================================ */
.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;
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  .site-header, .sidebar, .site-footer, .sub-nav, .btn { display: none !important; }
  .page-layout { display: block; }
  .article-wrap { box-shadow: none; border: none; }
}
