/**
 * siyam-style.css
 * Single stylesheet for all pages of IsSiyam.com.
 *
 * Sections:
 *   1. Reset & Variables
 *   2. Base / Typography
 *   3. Navigation
 *   4. Main Layout
 *   5. Checker Section (home page)
 *   6. Result Box
 *   7. Info Cards (home page)
 *   8. About / Contact Page Content
 *   9. Footer
 *  10. Responsive (≤ 768 px)
 */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;1,400&display=swap');


/* ── 1. Reset & Variables ─────────────────────────────────────────────────────── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --nav-bg:              #f5e29d;
  --nav-text:            #1a1a1a;
  --accent:              #2fc8f7;
  --bg:                  #fcf5da;
  --card-bg:             #fff;
  --text:                #222;

  /* Result box colours — fasting = dark blue, not fasting = light blue */
  --fasting-bg:          #1e3a5f;
  --fasting-border:      #2563eb;
  --fasting-text:        #ffffff;
  --not-fasting-bg:      #dbeafe;
  --not-fasting-border:  #93c5fd;
  --not-fasting-text:    #1e3a5f;
}


/* ── 2. Base / Typography ─────────────────────────────────────────────────────── */

/* font-size: 62.5% makes 1rem = 10px, so all rem values read as px ÷ 10 */
html {
  font-size: 62.5%;
  font-family: 'Roboto', sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
}

/* ── Page wrapper ─────────────────────────────────────────────────────────────
   Handles sticky-footer layout on all screen sizes.
   On wide desktops (>1200px) the body background switches to the header/footer
   colour, making the wrapper's cream area appear as a centred column flanked by
   matching yellow sidebars the full height of the page.                        */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
}

@media (min-width: 1200px) {
  body {
    background-color: var(--nav-bg); /* yellow — visible as sidebars */
  }

  .page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
  }
}

li { list-style: none; }
a  { text-decoration: none; }


/* ── 3. Navigation ────────────────────────────────────────────────────────────── */

/* sticky keeps the nav visible while scrolling long content pages */
.header {
  border-bottom: 2px solid #000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  background-color: var(--nav-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}

.nav-logo {
  color: var(--nav-text);
  font-size: 2.2rem;
  font-weight: 500;
}

.nav-menu {
  display: flex;
  gap: 4rem;
  align-items: center;
}

.nav-link {
  color: var(--nav-text);
  font-size: 1.6rem;
}

.nav-logo:hover,
.nav-link:hover {
  color: var(--accent);
}

/* Hamburger — hidden on desktop, shown via media query on mobile */
.hamburger {
  display: none;
  cursor: pointer;
  background: transparent;
  border: none;
}

.bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  background-color: var(--nav-text);
  transition: all 0.3s ease-in-out;
}


/* ── 4. Main Layout ───────────────────────────────────────────────────────────── */

/* flex: 1 on main pushes the footer to the bottom of the viewport */
main {
  flex: 1;
}

.banner-picture {
  display: block;
  width: 100%;
  /* On wide desktop screens, max-height prevents the banner from becoming
     excessively tall. object-fit: contain shows the full image (no cropping)
     scaled to fit within the capped height — any remaining space beside the
     image is filled with the page background colour so it blends in. */
  max-height: 420px;
  object-fit: contain;
  background-color: var(--bg);
}


/* ── 5. Checker Section (home page) ──────────────────────────────────────────── */

.checker {
  text-align: center;
  padding: 3rem 2rem 2rem;
}

.checker h1 {
  font-size: 2.6rem;
  margin-bottom: 0.6rem;
}

.checker h2 {
  font-size: 1.8rem;
  font-weight: 400;
  color: #555;
  margin-bottom: 2.4rem;
}

/* Date form — wraps naturally on narrow viewports */
.date-form {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.date-primary,
.date-secondary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* End date group is hidden by default; toggled visible via JS */
.date-secondary {
  display: none;
}

.date-secondary.visible {
  display: flex;
}

.date-arrow {
  font-size: 1.8rem;
  color: #888;
}

.date-form label {
  font-size: 1.6rem;
  font-weight: 500;
}

.date-form input[type="date"] {
  font-size: 1.6rem;
  padding: 0.6rem 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--card-bg);
  max-width: 18rem;
  width: 100%;
}

/* Secondary button style for the range toggle — visually lighter than Check */
.range-toggle {
  font-size: 1.4rem;
  padding: 0.5rem 1.2rem;
  background: transparent;
  color: #555;
  border: 1px solid #bbb;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.range-toggle:hover,
.range-toggle.active {
  background: #eee;
  color: #222;
  border-color: #888;
}

.check-btn {
  font-size: 1.6rem;
  padding: 0.6rem 2.4rem;
  background-color: var(--nav-bg);
  color: var(--nav-text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.check-btn:hover {
  background-color: #333;
}


/* ── 6. Result Box ────────────────────────────────────────────────────────────── */

.result {
  margin: 2rem auto;
  padding: 1.8rem 2rem;
  border-radius: 8px;
  max-width: 540px;
  border: 2px solid transparent;
}

.result h3 {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

.result p {
  font-size: 1.5rem;
}

.result.fasting {
  background-color: var(--fasting-bg);
  border-color: var(--fasting-border);
  color: var(--fasting-text);
}

/* Force every child element inside the dark fasting box to white —
   prevents the cascade from letting body/global colours bleed through */
.result.fasting * {
  color: var(--fasting-text);
}

.result.not-fasting {
  background-color: var(--not-fasting-bg);
  border-color: var(--not-fasting-border);
  color: var(--not-fasting-text);
}

/* Range result — summary line + breakdown rows */
.range-summary {
  font-size: 1.8rem;
  margin-bottom: 1.4rem;
}

.range-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Each row uses a two-column grid: label on the left, count on the right,
   with the date-span chips spanning the full width on the row below */
.range-row {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  padding: 0.9rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.2rem 1rem;
}

.range-label {
  font-size: 1.5rem;
  font-weight: 500;
  grid-column: 1;
  grid-row: 1;
}

.range-count {
  font-size: 1.4rem;
  font-weight: 500;
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
}

.range-spans {
  font-size: 1.4rem;
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.date-span {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

/* On the dark fasting background, flip the chip and row tints to white-based */
.result.fasting .range-row {
  background: rgba(255, 255, 255, 0.12);
}

.result.fasting .date-span {
  background: rgba(255, 255, 255, 0.18);
}


/* ── 7. Info Cards (home page) ────────────────────────────────────────────────── */

.info-cards {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto 3rem;
}

.card {
  background: var(--card-bg);
  border: 2.5px solid #bbb;
  border-radius: 8px;
  padding: 2rem;
  flex: 1;
}

.card h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.card ul {
  padding-left: 1.6rem;
}

.card ul li {
  list-style: disc;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 1.5rem;
  line-height: 1.6;
}


/* ── 8. About / Contact Page Content ─────────────────────────────────────────── */

.page-content {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.page-content h1 {
  font-size: 2.8rem;
  margin-bottom: 1.6rem;
}

.page-content h2 {
  font-size: 2rem;
  margin: 2rem 0 0.8rem;
}

.page-content p,
.page-content li {
  font-size: 1.6rem;
  line-height: 1.7;
  margin-bottom: 0.8rem;
}

.page-content ul {
  padding-left: 2rem;
  margin-bottom: 1.2rem;
}

.page-content a {
  color: #0070f3;
  text-decoration: underline;
}

/* Table scrolls horizontally on small screens rather than overflowing */
.fast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.5rem;
  margin: 1.6rem 0;
}

.fast-table th,
.fast-table td {
  text-align: left;
  padding: 0.9rem 1.2rem;
  border: 1px solid #ddd;
}

.fast-table th {
  background: var(--nav-bg);
  color: var(--nav-text);
}

.fast-table tr:nth-child(even) td {
  background: #f9f9f9;
}


/* ── 9. Footer ────────────────────────────────────────────────────────────────── */

footer {
  background-color: var(--nav-bg);
  color: var(--nav-text);
  text-align: center;
  padding: 1.2rem 0;
  font-size: 1.4rem;
}


/* ── 10. Responsive (≤ 768 px) ───────────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Nav — slide-in drawer replaces horizontal menu */
  .nav-menu {
    position: fixed;
    left: -100%;
    top: 5rem;
    flex-direction: column;
    background-color: var(--nav-bg);
    width: 100%;
    text-align: center;
    padding: 1rem 0 2rem;
    transition: left 0.3s;
    gap: 0;
  }

  .nav-menu.active { left: 0; }
  .nav-item        { margin: 1.5rem 0; }
  .hamburger       { display: block; }

  /* Hamburger → X animation */
  .hamburger.active .bar:nth-child(2) { opacity: 0; }
  .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* Checker */
  .checker      { padding: 2rem 1.2rem 1.2rem; }
  .checker h1   { font-size: 2rem; }
  .checker h2   { font-size: 1.5rem; }

  /* Date form — stack all elements vertically for easy tapping */
  .date-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    padding: 0 0.4rem;
  }

  .date-primary,
  .date-secondary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* Arrow is meaningful on wide layouts but redundant when stacked */
  .date-arrow { display: none; }

  .date-form input[type="date"],
  .range-toggle,
  .check-btn {
    width: 100%;
    max-width: 100%;
    font-size: 1.6rem;
    padding: 0.9rem 1rem;
  }

  /* Result */
  .result    { margin: 1.4rem 0.8rem; }
  .result h3 { font-size: 1.9rem; }

  /* Range rows — collapse two-column grid to single column */
  .range-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .range-count {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }

  .range-spans { grid-row: 3; }

  /* Info cards */
  .info-cards {
    flex-direction: column;
    padding: 1.2rem;
  }

  /* About / Contact */
  .page-content {
    padding: 0 1.2rem;
    margin: 2rem auto;
  }

  .page-content h1 { font-size: 2.2rem; }
  .page-content h2 { font-size: 1.7rem; }

  /* Fast table — scroll rather than overflow on small screens */
  .fast-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
