/* Site stylesheet: one small file, mobile first, works in RTL. */

:root {
  --bg: #f8f7f3;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #4d5866;
  --line: #d9d5cb;
  --brand: #0b5563;
  --brand-dark: #083f49;
  --brand-tint: #e5f0f1;
  --accent: #9a5b00;
  --error: #a4161a;
  --focus: #b86a00;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Segoe UI", "Geeza Pro", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}

html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.8; }

a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { color: var(--brand-dark); }

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

.skip-link {
  position: absolute;
  inset-inline-start: 0.5rem;
  top: -3rem;
  background: var(--brand-dark);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; color: #fff; }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-inline-end: auto;
}
.brand-mark {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--brand);
  border-radius: 2px;
  margin-inline-end: 0.5rem;
  transform: rotate(45deg);
  vertical-align: 0.1em;
}
.site-nav { order: 3; flex-basis: 100%; }
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
}
.site-nav a { text-decoration: none; padding: 0.25rem 0; display: inline-block; }
.site-nav a[aria-current="page"] { font-weight: 700; color: var(--text); border-bottom: 2px solid var(--brand); }

.lang-toggle {
  font: inherit;
  font-size: 0.95rem;
  background: var(--brand-tint);
  color: var(--brand-dark);
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  min-height: 2.5rem;
}
.lang-toggle:hover { background: #d4e6e8; }

/* Main */
main { padding: 1.5rem 0 2.5rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }
p { margin: 0 0 0.9rem; }
.lead { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.93rem; }

.how {
  background: var(--surface);
  border-inline-start: 4px solid var(--brand);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.97rem;
}
html[dir="rtl"] .how { border-radius: var(--radius) 0 0 var(--radius); }

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

/* Tool list on the hub */
.tool-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 1rem; }
.tool-list li { margin: 0; }
.tool-list h2 { margin-top: 0; }
.tool-list a.tool-link { font-weight: 700; }

/* Forms */
.field { margin: 0 0 1.1rem; }
label, legend { display: block; font-weight: 600; margin-bottom: 0.35rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.hint { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 0.3rem; }

input[type="text"],
input[type="date"],
select {
  font: inherit;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #8a8f98;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

.input-with-suffix { display: flex; align-items: stretch; }
.input-with-suffix input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-with-suffix .suffix {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  border: 1px solid #8a8f98;
  border-inline-start: 0;
  border-start-end-radius: 8px;
  border-end-end-radius: 8px;
  background: #f0eee8;
  font-weight: 600;
  white-space: nowrap;
}

.radio, .check { display: flex; align-items: center; gap: 0.55rem; margin: 0.35rem 0; }
.radio label, .check label { font-weight: 400; margin: 0; }
.radio input, .check input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--brand); flex: none; }

.days-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }

.row { display: grid; gap: 0 1rem; }

.btn {
  font: inherit;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  min-height: 2.9rem;
  cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--brand-dark); }
.btn-secondary:hover { background: var(--brand-tint); }

.link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0.2rem 0.3rem;
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}

.inline-add { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-add .field { flex: 1 1 12rem; margin-bottom: 0; }

.holiday-list { margin: 0.75rem 0 0.25rem; padding-inline-start: 1.2rem; }
.holiday-list li { margin: 0.15rem 0; }

/* Results */
.output { margin-top: 0.5rem; }
.result-table { width: 100%; border-collapse: collapse; margin: 0.25rem 0 0.75rem; }
.result-table th,
.result-table td { padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--line); text-align: start; }
.result-table th { font-weight: 500; }
.result-table td.num { text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.result-table tr.total th,
.result-table tr.total td { font-weight: 700; font-size: 1.1rem; border-bottom: 2px solid var(--text); }

.facts { display: grid; grid-template-columns: 1fr; gap: 0.1rem 1rem; margin: 0; font-size: 0.95rem; }
.facts dt { font-weight: 600; margin-top: 0.4rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.notice {
  background: #fff7e6;
  border: 1px solid #e3c27a;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}
.notice-title { font-weight: 700; margin-bottom: 0.3rem; }
.notice p:last-child { margin-bottom: 0; }

.error { color: var(--error); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.25rem 0 2rem; font-size: 0.93rem; color: var(--muted); }
.site-footer p { margin: 0.3rem 0; }

@media (min-width: 40rem) {
  .site-nav { order: 0; flex-basis: auto; }
  h1 { font-size: 2rem; }
  .row-2 { grid-template-columns: 1fr 1fr; }
  .days-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts { grid-template-columns: max-content 1fr; }
  .facts dt { margin-top: 0; }
  .card { padding: 1.4rem; }
}

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

[hidden] { display: none !important; }
.card > h2:first-child { margin-top: 0; }
#wd-holiday-msg:empty { display: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
