/* ============================================================
   GC INSTRUCTIONS MANUAL — Master Stylesheet
   Version: 1.0 (en-US master)
   Font stack: Avenir Next → Avenir → system sans-serif
   ============================================================ */

/* ── Custom Properties ───────────────────────────────────── */
:root {
  /* Brand palette */
  --color-black:        #1a1a1a;
  --color-dark-gray:    #3a3a3a;
  --color-mid-gray:     #6b6b6b;
  --color-light-gray:   #c8c8c8;
  --color-off-white:    #f5f4f2;
  --color-white:        #ffffff;
  --color-accent:       #b0a090;   /* warm gold-gray — adjust to brand */

  /* Typography */
  --font-primary:       "Avenir Next", "Avenir", "Century Gothic", "Trebuchet MS", Arial, sans-serif;
  --font-size-base:     15px;
  --line-height-base:   1.6;

  /* Spacing */
  --space-xs:  0.4rem;
  --space-sm:  0.75rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;

  /* Layout */
  --content-width:      720px;
  --narrow-width:       560px;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--color-dark-gray);
  background-color: var(--color-white);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

/* ── Links ───────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

/* In-content cross-reference links (e.g. table cells linking to a
   procedure section below) should read as clickable, unlike nav/lang-picker
   links which intentionally inherit surrounding text styling. */
table.water-resistance a {
  color: var(--color-accent);
  text-decoration: underline;
}
table.water-resistance a:hover,
table.water-resistance a:focus {
  color: var(--color-dark-gray);
}

/* ── Page Layout ─────────────────────────────────────────── */
.manual-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* ── Cover ───────────────────────────────────────────────── */
.cover {
  background-color: var(--color-white);
  color: var(--color-dark-gray);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
}

.cover .brand-logo {
  width: 300px;
  max-width: 55%;
  margin-top: var(--space-xl);
}

.cover-copy {
  max-width: 520px;
  margin: 0 auto var(--space-lg);
}

.cover-copy p {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-dark-gray);
  margin-bottom: var(--space-sm);
}

.cover-copy p:last-child {
  margin-bottom: 0;
}

/* ── Brand Intro (back of cover) ─────────────────────────── */
.brand-intro {
  background-color: var(--color-off-white);
  padding: var(--space-xl) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}

.brand-intro .brand-logo {
  width: 180px;
  max-width: 50%;
}

/* ── Brand Description ───────────────────────────────────── */
.brand-description {
  max-width: var(--narrow-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.brand-description p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--color-dark-gray);
  margin-bottom: var(--space-md);
}

.brand-description .tagline {
  font-style: italic;
  font-weight: 600;
  color: var(--color-black);
  margin-top: var(--space-md);
}

/* ── Section Dividers ────────────────────────────────────── */
section + section,
.watch-features,
.instructions-section {
  border-top: 1px solid var(--color-light-gray);
}

/* ── Watch Features ──────────────────────────────────────── */
.watch-features {
  padding: var(--space-xl) var(--space-md);
  max-width: var(--content-width);
  margin: 0 auto;
}

.watch-features h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-md);
}

.watch-features > h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-lg);
}

/* ── Shared Article Styles ───────────────────────────────── */
article {
  margin-bottom: var(--space-xl);
}

article h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-black);
  margin-bottom: var(--space-xs);
}

article h4 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

article h5 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-dark-gray);
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

article p {
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: var(--space-sm);
}

/* Subtitle / sub-type label under h3 */
.movement-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-md);
  display: none;
}

/* ── Instructions Section ─────────────────────────────────── */
.instructions-section {
  padding: var(--space-xl) var(--space-md);
  max-width: var(--content-width);
  margin: 0 auto;
}

.instructions-section > h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-lg);
}

/* ── Numbered Steps (ol) ─────────────────────────────────── */
ol.steps {
  list-style: none;
  counter-reset: step-counter;
  padding-left: 0;
  margin-bottom: var(--space-md);
}

ol.steps li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2rem;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

ol.steps li::before {
  content: counter(step-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--color-accent);
  font-size: 0.85rem;
}

/* ── Bullet Lists (ul) ───────────────────────────────────── */
ul.feature-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: var(--space-md);
}

ul.feature-list li {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

ul.feature-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* ── Notes & Warnings ────────────────────────────────────── */
.note {
  background-color: var(--color-off-white);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-dark-gray);
}

.note strong {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-bottom: 0.25rem;
}

/* ── 2×2 Diagram Grid ────────────────────────────────────── */
/*    Used for: Chronograph overview, and similar spreads    */
.diagram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-md);
  margin: var(--space-lg) 0;
}

.diagram-grid figure {
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;        /* fill the grid cell */
}

.diagram-grid figure img {
  flex: 1;             /* image takes all cell height above the caption */
  min-height: 0;       /* allow flex to shrink below intrinsic size */
  max-height: 200px;
  width: auto;
  max-width: 100%;
  object-fit: contain; /* preserve aspect ratio while filling the flex space */
  object-position: center center;
}

.diagram-grid figcaption {
  display: block; /* Override base hide — diagram-grid captions are visible */
  margin-top: var(--space-xs);
  font-size: 0.72rem;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 2px;
  letter-spacing: 0.04em;
  color: var(--color-dark-gray);
  text-transform: uppercase;
}

@media (max-width: 500px) {
  .diagram-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Float-right figure (image beside text) ─────────────── */
/*    Used for: Screw Down Crown illustration, and similar   */
figure.float-right {
  float: right;
  margin: 0 0 var(--space-md) var(--space-lg);
  max-width: 160px;
  clear: right;
}

figure.float-right img {
  width: 100%;
  height: auto;
  display: block;
}

figure.float-right figcaption {
  font-size: 0.7rem;
  text-align: center;
  margin-top: var(--space-xs);
}

/* Figure + example text in one row, vertically centered */
.inline-figure-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.inline-figure-text figure {
  margin: 0;
  flex: 0 0 auto;
}

.inline-figure-text p {
  margin: 0;
}

/* Clearfix after any article that uses float-right figures */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

@media (max-width: 480px) {
  figure.float-right {
    float: none;
    max-width: 140px;
    margin: var(--space-md) auto;
  }

  .inline-figure-text {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Figures & Diagrams ──────────────────────────────────── */
figure {
  margin: var(--space-lg) 0;
  text-align: center;
}

figure img,
figure svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

figure.diagram img,
figure.diagram svg {
  /*
   * max-height caps vertical size across all locales without breaking aspect ratio.
   * Translated labels may expand the SVG viewBox horizontally — width:auto lets
   * the image grow wider freely. If the container is too narrow to fit the image
   * at full height, max-width:100% kicks in and BOTH dimensions scale down
   * proportionally, keeping aspect ratio intact. Height target yields to
   * aspect ratio; never the other way around.
   */
  max-height: 280px;
  width: auto;
  max-width: 100%;
}

figcaption {
  display: none; /* Hidden visually; kept in markup for semantic/AI indexing */
  margin-top: var(--space-sm);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
}

/* ── BA Reference Sheet figures ──────────────────────────── */
figure.caliber-ref {
  border: 1px solid var(--color-light-gray);
  padding: var(--space-sm);
  background: var(--color-off-white);
}

figure.caliber-ref figcaption {
  text-align: left;
  margin-top: var(--space-sm);
}

/* ── Water Resistance Table ──────────────────────────────── */
table.water-resistance {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.85rem;
}

table.water-resistance th,
table.water-resistance td {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-light-gray);
}

table.water-resistance th {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--color-mid-gray);
  background-color: var(--color-off-white);
}

/* Responsive scroll wrapper — lets wide/multi-column tables
   (e.g. Solar Power charging guidelines) scroll horizontally
   on narrow screens instead of squeezing or overflowing the page. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-md) 0;
}

.table-scroll table.water-resistance {
  margin: 0;
  min-width: 480px;
}

.table-scroll table.water-resistance td,
.table-scroll table.water-resistance th {
  white-space: nowrap;
}

/* ── Full Moon Dates Table ───────────────────────────────── */
table.full-moon-dates {
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.85rem;
  width: 100%;
}

table.full-moon-dates caption {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: var(--space-sm) var(--space-sm);
  background-color: var(--color-light-gray);
  color: var(--color-black);
  caption-side: top;
  margin-bottom: 0;
}

table.full-moon-dates th,
table.full-moon-dates td {
  padding: 0.35rem 0.6rem;
  text-align: center;
  border-bottom: 1px solid var(--color-light-gray);
}

table.full-moon-dates thead th {
  font-weight: 600;
  color: var(--color-mid-gray);
  font-size: 0.78rem;
  border-bottom: 2px solid var(--color-light-gray);
}

/* Month labels — left-aligned, bold */
table.full-moon-dates tbody th[scope="row"] {
  text-align: left;
  font-weight: 700;
  color: var(--color-black);
  white-space: nowrap;
}

table.full-moon-dates tbody td {
  color: var(--color-dark-gray);
  font-variant-numeric: tabular-nums;
}

table.full-moon-dates tbody tr:last-child th,
table.full-moon-dates tbody tr:last-child td {
  border-bottom: none;
}

/* ── Battery Care / Warranty ─────────────────────────────── */
.battery-warranty {
  padding: var(--space-xl) var(--space-md);
  max-width: var(--content-width);
  margin: 0 auto;
}

.battery-warranty h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-md);
}

.battery-warranty h3 {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-black);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.battery-warranty p {
  font-size: 0.85rem;
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

.battery-warranty ul {
  list-style: none;
  padding-left: 0;
}

.battery-warranty ul li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

.battery-warranty ul li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--color-mid-gray);
}

/* ── Back Cover ──────────────────────────────────────────── */
.back-cover {
  background-color: var(--color-off-white);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.back-cover .brand-tagline {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-mid-gray);
}

.back-cover .brand-logo {
  width: 160px;
  max-width: 45%;
}

/* ── Back Page (recycling / contact) ─────────────────────── */
.back-page {
  padding: var(--space-xl) var(--space-md);
  max-width: var(--narrow-width);
  margin: 0 auto;
  text-align: center;
}

.back-page .recycle-icon {
  width: 40px;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.back-page p {
  font-size: 0.85rem;
  color: var(--color-mid-gray);
  margin-bottom: var(--space-xs);
}

.back-page a {
  font-weight: 600;
  color: var(--color-dark-gray);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
}

/* ── Utility: Screen-reader only ─────────────────────────── */
.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 Styles ────────────────────────────────────────── */
@media print {
  body {
    font-size: 11pt;
    color: #000;
  }

  .cover {
    min-height: auto;
    page-break-after: always;
  }

  figure {
    page-break-inside: avoid;
  }

  article {
    page-break-inside: avoid;
  }

  .note {
    border-left-color: #999;
    background: #f8f8f8;
  }

  a {
    text-decoration: none;
    color: #000;
  }
}

/* ── RTL Support (Arabic — ar-SA) ───────────────────────── */
/*
 * Applied via dir="rtl" on the <html> element.
 * All LTR-specific properties are mirrored here.
 */
[dir="rtl"] body {
  direction: rtl;
  /* Arabic system fonts as first choices; falls back to the standard stack */
  font-family: "Segoe UI", "Tahoma", "Cairo", "Noto Naskh Arabic",
               "Avenir Next", "Avenir", Arial, sans-serif;
}

/* Note border flips from left to right */
[dir="rtl"] .note {
  border-left: none;
  border-right: 3px solid var(--color-accent);
}

/* Float-right screw-down crown illustration becomes float-left in RTL */
[dir="rtl"] figure.float-right {
  float: left;
  margin: 0 var(--space-lg) var(--space-md) 0;
}

/* Step numbers align to the right */
[dir="rtl"] ol.steps li {
  padding-left: 0;
  padding-right: 2rem;
}

[dir="rtl"] ol.steps li::before {
  left: auto;
  right: 0;
}

/* Bullet list bullets align to the right */
[dir="rtl"] ul.feature-list li {
  padding-left: 0;
  padding-right: 1.2rem;
}

[dir="rtl"] ul.feature-list li::before {
  left: auto;
  right: 0;
}

/* Warranty list dashes align to the right */
[dir="rtl"] .battery-warranty ul li {
  padding-left: 0;
  padding-right: 1rem;
}

[dir="rtl"] .battery-warranty ul li::before {
  left: auto;
  right: 0;
}

/* Full Moon table caption: right-aligned in RTL */
[dir="rtl"] table.full-moon-dates caption {
  text-align: right;
}

/* Full Moon month labels right-aligned in RTL */
[dir="rtl"] table.full-moon-dates tbody th[scope="row"] {
  text-align: right;
}

/* Tables: left-aligned columns become right-aligned */
[dir="rtl"] table.water-resistance th,
[dir="rtl"] table.water-resistance td {
  text-align: right;
}

/* Clearfix still needed */
[dir="rtl"] .clearfix::after {
  content: "";
  display: table;
  clear: both;
}

@media (max-width: 480px) {
  [dir="rtl"] figure.float-right {
    float: none;
    max-width: 140px;
    margin: var(--space-md) auto;
  }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  :root {
    --font-size-base: 14px;
  }

  .cover-copy p {
    font-size: 0.85rem;
    letter-spacing: 0.01em;
  }

  table.water-resistance {
    font-size: 0.8rem;
  }

  .table-scroll {
    margin: var(--space-sm) 0;
    /* Fade cue on the trailing edge to hint there's more to scroll */
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  }

  .table-scroll table.water-resistance {
    font-size: 0.78rem;
    min-width: 460px;
  }

  .table-scroll table.water-resistance th,
  .table-scroll table.water-resistance td {
    padding: var(--space-xs) var(--space-xs);
  }

  figure.diagram img,
  figure.diagram svg {
    max-width: 100%;
  }
}
