/*
 * Abraj astro tools: only what the tool pages add on top of /styles.css (the landing page's sheet, loaded first).
 * Same tokens, logical properties for RTL, no data: URIs and no inline styles anywhere (page CSP).
 */

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Frame ---------- */

.tool-top {
  padding-block: clamp(16px, 4vw, 28px) 0;
  text-align: center;
}

.tool-brand {
  display: inline-block;
  font-size: clamp(2.25rem, 1.8rem + 2vw, 3rem);
  text-decoration: none;
}

.tool {
  max-width: 760px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 0;
  margin: 8px 0 0;
  padding: 0;
  color: var(--on-dark-3);
  font-size: 0.875rem;
  list-style: none;
}

.crumbs li + li::before {
  content: "‹";
  margin-inline: 8px;
  color: var(--gold-500);
}

.crumbs a {
  color: var(--on-dark-2);
  text-underline-offset: 4px;
}

.tool-title {
  margin-block: 12px 4px;
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 1.4rem + 2.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
}

.tool-lede {
  max-width: 34rem;
  margin: 0 auto 20px;
  color: var(--on-dark-2);
  text-align: center;
}

/* ---------- Form ---------- */

.tool-card {
  display: grid;
  gap: 20px;
  padding: clamp(18px, 4.5vw, 32px);
  color: var(--on-dark-2);
  background: var(--surface-dark);
  border: 1px solid var(--line-dark);
  border-radius: var(--r-xl);
}

.group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.group legend {
  margin-block-end: 8px;
  padding: 0;
  color: var(--on-dark);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.5;
}

.row3,
.row2 {
  display: grid;
  gap: 10px;
}

.row3 {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr) minmax(0, 1fr);
}

.row2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 22rem;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field > span {
  color: var(--on-dark-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

.tool-card select,
.tool-card input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  color: var(--on-dark);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.4;
  background: var(--bg-deep);
  border: 1px solid #ffffff33;
  border-radius: 14px;
}

.tool-card select {
  padding-inline-end: 8px;
}

.tool-card input#f-hour,
.tool-card input#f-minute {
  text-align: center;
}

.tool-card select:hover,
.tool-card input:hover {
  border-color: #e4bf7c99;
}

.tool-card select:focus-visible,
.tool-card input:focus-visible {
  outline: 3px solid var(--gold-300);
  outline-offset: 1px;
  border-color: var(--gold-400);
}

.tool-card [aria-invalid="true"] {
  border-color: var(--blush-300);
}

.tool-card ::placeholder {
  color: var(--on-dark-3);
  opacity: 1;
}

.field-help {
  margin-block-end: 8px;
  color: var(--on-dark-3);
  font-size: 0.875rem;
  line-height: 1.7;
}

.field-error {
  margin-block-start: 8px;
  padding: 8px 12px;
  color: var(--on-dark);
  font-size: 0.9375rem;
  line-height: 1.7;
  background: #e9a3bf1f;
  border: 1px solid #e9a3bf66;
  border-radius: 12px;
}

.attribution {
  margin-block-start: 10px;
  color: var(--on-dark-3);
  font-size: 0.75rem;
  line-height: 1.6;
}

/* City combobox */

.combo .field {
  margin-block-end: 4px;
}

.combo-box {
  display: flex;
  gap: 8px;
}

.combo-box input {
  flex: 1 1 auto;
}

.combo-clear {
  flex: none;
  min-height: 50px;
  padding: 8px 14px;
  color: var(--gold-300);
  font: inherit;
  font-size: 0.9375rem;
  background: transparent;
  border: 1px solid #e4bf7c66;
  border-radius: 14px;
  cursor: pointer;
}

.combo-list {
  max-height: 18rem;
  margin-block-start: 6px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid #e4bf7c4d;
  border-radius: 14px;
}

.combo-opt {
  padding: 10px 14px;
  color: var(--on-dark);
  line-height: 1.5;
  cursor: pointer;
}

.combo-opt + .combo-opt {
  border-block-start: 1px solid var(--line-dark);
}

.combo-opt:hover,
.combo-opt[aria-selected="true"] {
  background: #e4bf7c26;
}

/* Submit: the landing page's gold .cta, as a full-width button */

.tool-submit {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.privacy {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
  color: var(--on-dark-3);
  font-size: 0.875rem;
  line-height: 1.7;
  text-align: center;
}

.privacy svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-block-start: 3px;
  color: var(--gold-400);
}

/* ---------- Result ---------- */

.tool-result {
  display: grid;
  gap: 14px;
  margin-block-start: 20px;
  scroll-margin-block-start: 16px;
}

.result-card {
  display: grid;
  gap: 10px;
  padding: clamp(18px, 4.5vw, 28px);
  color: var(--on-dark-2);
  background: linear-gradient(150deg, var(--surface-dark-alt), var(--surface-dark) 60%);
  border: 1px solid #e4bf7c4d;
  border-radius: var(--r-xl);
}

.result-head {
  display: flex;
  gap: 16px;
  align-items: center;
}

.result-orb {
  display: grid;
  flex: none;
  place-items: center;
  width: 76px;
  aspect-ratio: 1;
  color: var(--gold-300);
  background: radial-gradient(circle, #e4bf7c2e, transparent 70%);
  border: 1px solid #e4bf7c80;
  border-radius: 50%;
}

.result-orb-sm {
  width: 52px;
}

.glyph {
  width: 56%;
  height: 56%;
}

.result-body {
  min-width: 0;
}

.result-label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--on-dark-2);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.label-icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--gold-400);
}

.result-sign {
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.35;
}

.result-missing {
  color: var(--on-dark);
  font-size: 1.0625rem;
  font-weight: 700;
}

/* Focus is moved here after a calculation (tabindex -1) so screen readers land on the result; it is not a control. */
.result-sign:focus,
.result-sign:focus-visible,
.result-missing:focus,
.result-missing:focus-visible {
  outline: none;
}

.result-note {
  color: var(--on-dark-2);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.result-fine {
  color: var(--on-dark-3);
  font-size: 0.875rem;
}

.result-modules {
  background: var(--surface-dark);
  border-color: var(--line-dark);
}

.module {
  display: grid;
  gap: 4px;
}

.module + .module {
  padding-block-start: 10px;
  border-block-start: 1px solid var(--line-dark);
}

.module-title {
  color: var(--gold-300);
  font-size: 1.25rem;
}

.module p {
  color: var(--on-dark-2);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 44px;
  padding: 8px 16px;
  color: var(--on-dark);
  font: inherit;
  font-size: 0.9375rem;
  background: #171c47b3;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  color: var(--on-light);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-from), var(--gold-to));
  border-color: transparent;
}

.tool-cta {
  display: flex;
  justify-content: center;
  margin-block-start: 20px;
}

/* ---------- القمر اليوم ---------- */

.mt-phase {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.moon-disc {
  width: clamp(96px, 28vw, 132px);
  height: auto;
  aspect-ratio: 1;
}

.moon-dark {
  fill: #0a0e2a;
  stroke: #e4bf7c66;
  stroke-width: 1;
}

.moon-lit {
  fill: var(--gold-300);
}

.mt-phase-text {
  display: grid;
  gap: 4px;
}

.mt-phase .result-sign {
  font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.125rem);
}

.mt-lit {
  color: var(--on-dark);
}

.mt-events {
  gap: 16px;
}

.mt-event {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mt-event + .mt-event {
  padding-block-start: 14px;
  border-block-start: 1px solid var(--line-dark);
}

.mt-event-title {
  color: var(--gold-300);
  font-size: 1.1875rem;
}

.mt-event-when {
  color: var(--on-dark);
  font-weight: 700;
}

/* ---------- Explainer, links, disclaimer ---------- */

.tool-explain {
  margin-block-start: clamp(40px, 8vw, 64px);
  color: var(--on-dark-2);
}

.tool-explain h2,
.tool-links h2 {
  margin-block-end: 12px;
  color: var(--gold-400);
  font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
}

.tool-explain p + p {
  margin-block-start: 12px;
}

.tool-links {
  margin-block-start: clamp(32px, 6vw, 48px);
}

.tool-links ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 10px;
}

.tool-links a {
  display: block;
  min-height: 48px;
  padding: 12px 16px;
  color: var(--on-dark);
  font-weight: 700;
  text-decoration: none;
  background: var(--surface-dark);
  border: 1px solid var(--line-dark);
  border-radius: var(--r-md);
}

.tool-links a:hover {
  color: var(--gold-300);
  border-color: #e4bf7c80;
}

.tool-disclaimer {
  margin-block-start: clamp(32px, 6vw, 48px);
  font-size: 0.9375rem;
}

@media (max-width: 380px) {
  .row3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .row3 .field:first-child {
    grid-column: 1 / -1;
  }

  .mt-phase {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }

  .mt-phase .result-label {
    justify-content: center;
  }
}

@media (forced-colors: active) {
  .moon-lit {
    fill: CanvasText;
  }

  .chip[aria-pressed="true"] {
    border: 2px solid Highlight;
  }
}
