/* ==========================================================================
   Swiss Gold House - ring-size.css
   Only loaded by ring-size.html (en / si / ta). Driven by js/ring-size.js.
   Uses the design tokens from css/styles.css; adds none of its own.
   ========================================================================== */

/* The tool needs JavaScript; without it only the chart and tips show. */
.rs { display: none; }
html.js .rs { display: block; }

.rs { max-width: 46rem; margin-top: clamp(1.6rem, 4vw, 2.4rem); }
@media (min-width: 600px) {
  .rs { background: var(--paper); border: 1px solid var(--line); padding: clamp(1.4rem, 3vw, 2.2rem); }
}

.rs-step { scroll-margin-top: calc(var(--header-h) + 1rem); }
.rs-step[hidden], .rs [hidden] { display: none; }
.rs-step h2 { margin: 0.4rem 0 0.8rem; }
.rs-step h2:focus { outline: none; }
.rs-step p, .rs-steps { color: var(--ink-2); }

.rs-steps { list-style: decimal; padding-left: 1.3rem; margin-top: 0.8rem; }
.rs-steps li + li { margin-top: 0.35rem; }
.rs-steps li::marker { color: var(--gold-ink); font-weight: 700; }

.rs-saved { margin-top: 0.6rem; font-size: 0.95rem; }
.rs-saved [data-saved-note] { font-style: italic; }

.rs-warn {
  margin-bottom: 1.2rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid #A04B33;
  background: #FBF1EC;
  color: #7A3422;
  font-size: 1rem;
  line-height: 1.6;
}

/* - and + buttons either side of a slider */
.rs-ctrl { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.3rem; }
.rs-ctrl input[type="range"] { flex: 1; min-width: 0; height: 44px; margin: 0; accent-color: var(--gold-ink); cursor: pointer; }
.rs-btn {
  flex: none;
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
  font: 600 1.7rem/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.rs-btn:hover { background: var(--ink); color: #F8F8F8; }

/* Drawing areas: true-size shapes in CSS pixels */
.rs-stage { position: relative; overflow: hidden; margin-top: 1rem; background: var(--paper-warm); }
@media (max-width: 599px) {
  /* Edge to edge on phones: a card is about as wide as the screen. */
  .rs-stage--card { margin-inline: calc(-1 * var(--gutter)); }
}
.rs-card {
  position: absolute; top: 18px; left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  background: var(--gold-soft);
  border: 1px solid var(--gold-ink); border-bottom: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
  mask-image: linear-gradient(to bottom, #000 65%, transparent);
}

.rs-stage--ring { border: 1px solid var(--line); }
.rs-stage--ring::before, .rs-stage--ring::after {
  content: ""; position: absolute; z-index: 1; background: var(--gold-ink); opacity: 0.35;
}
.rs-stage--ring::before { left: 0; right: 0; top: 50%; height: 1px; }
.rs-stage--ring::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.rs-disc {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--gold-soft);
  border: 1px solid var(--gold-ink);
}

.rs-next { margin-top: 1.4rem; }

/* Result: Indian, UK, US */
.rs-result { margin-top: 1.4rem; }
.rs-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.rs-sizes > div { padding: 0.8rem 0.4rem 0.7rem; border: 1px solid var(--line); background: var(--paper-warm); text-align: center; }
.rs-sizes dt { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-ink); }
.rs-sizes dd { margin-top: 0.15rem; font-family: var(--font-display); font-size: clamp(2rem, 7vw, 2.6rem); font-weight: 600; line-height: 1.15; color: var(--ink); }
.rs-dims { margin-top: 0.8rem; font-size: 1rem; }

.rs-wa { margin-top: 1.4rem; }
@media (min-width: 600px) { .rs-wa { width: auto; min-width: 340px; } }
.rs-note { margin-top: 0.5rem; font-size: 0.92rem; }
.rs-again { margin: 0; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }

/* Tips list + "no ring" card */
.rs-tips { list-style: disc; padding-left: 1.2rem; margin-top: 1.2rem; color: var(--ink-2); }
.rs-tips li + li { margin-top: 0.7rem; }
.rs-tips li::marker { color: var(--gold-ink); }
.rs-aside { background: var(--paper-warm); }
.rs-aside p { color: var(--ink-2); margin-top: 0.6rem; }
.rs-aside .pill-row { margin-top: 1.4rem; }

/* Size chart */
.rs-chart-note { max-width: 46rem; margin-top: 0.8rem; color: var(--ink-2); }
.rs-chart-wrap { max-width: 46rem; margin-top: 1.4rem; overflow-x: auto; border: 1px solid var(--line); background: var(--paper); }
.rs-chart { width: 100%; border-collapse: collapse; font-size: 1rem; }
.rs-chart th, .rs-chart td { padding: 0.45rem 0.6rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rs-chart thead th { font-size: 0.85rem; font-weight: 700; line-height: 1.3; white-space: normal; color: var(--gold-ink); background: var(--champagne); vertical-align: bottom; }
.rs-chart tbody th { font-weight: 700; color: var(--ink); }
.rs-chart td { color: var(--ink-2); }
.rs-chart tbody tr:last-child > * { border-bottom: 0; }
.rs-chart tr.is-match > * { background: var(--champagne); color: var(--ink); font-weight: 700; }
@media (max-width: 479px) {
  .rs-chart th, .rs-chart td { padding: 0.45rem 0.3rem; }
}

/* Card under the intro linking to the other methods */
.rs-jump {
  display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 1.4rem);
  max-width: 46rem; margin-top: 1.3rem;
  padding: 0.9rem clamp(0.9rem, 3vw, 1.3rem);
  background: var(--paper);
  border: 1px solid var(--line); border-left: 3px solid var(--gold-ink);
  color: var(--ink-2); text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.rs-jump:hover { background: var(--champagne); border-color: var(--gold-ink); }
.rs-jump img { flex: none; width: clamp(72px, 19vw, 128px); height: auto; }
.rs-jump__text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; font-size: 1rem; line-height: 1.5; }
.rs-jump strong { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; line-height: 1.2; color: var(--ink); }
.rs-jump__cta { display: block; margin-top: 0.2rem; font-weight: 700; color: var(--gold-ink); }
.rs-jump__cta .ic { display: inline-block; width: 1.15em; height: 1.15em; margin-left: 0.3rem; vertical-align: -0.2em; fill: currentColor; transform: rotate(90deg); transition: transform var(--t-fast); }
.rs-jump:hover .rs-jump__cta .ic { transform: rotate(90deg) translateX(3px); }

/* ---- Other ways to measure: ruler, paper strip, printed circles -------- */
#other-ways { scroll-margin-top: var(--header-h); }
.rs-intro { max-width: 46rem; margin-top: 0.8rem; color: var(--ink-2); }

.rs-methods { display: grid; gap: 1.2rem; margin-top: clamp(1.6rem, 4vw, 2.4rem); }
.rs-method { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); }
.rs-method img { width: 100%; border-bottom: 1px solid var(--line); }
.rs-method__body { display: flex; flex-direction: column; align-items: flex-start; padding: 1.2rem clamp(1.1rem, 3vw, 1.6rem) 1.5rem; }
.rs-method h3 { margin-bottom: 0.2rem; }
.rs-method p { color: var(--ink-2); }
/* Tablets: picture beside the steps. Desktops: three cards side by side. */
@media (min-width: 600px) and (max-width: 999px) {
  .rs-method { flex-direction: row; align-items: flex-start; }
  .rs-method img { width: 42%; flex: none; border-bottom: 0; border-right: 1px solid var(--line); }
}
@media (min-width: 1000px) {
  .rs-methods { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The print button needs JavaScript; without it the browser's own Print still works. */
html:not(.js) .rs-print, html:not(.js) .rs-print-note { display: none; }
.rs-print { margin-top: 1.3rem; }
.rs-print-note { font-size: 0.92rem; margin-top: 0.5rem; }

/* ---- Calculator: mm -> Indian, UK, US (needs JavaScript) ---------------- */
.rs-calc { display: none; }
html.js .rs-calc { display: block; }
.rs-calc {
  max-width: 46rem;
  margin-top: clamp(1.6rem, 4vw, 2.4rem);
  padding: clamp(1.3rem, 3vw, 2.2rem);
  background: var(--paper);
  border: 1px solid var(--line);
}
.rs-calc [hidden] { display: none; }
.rs-calc h3 { margin-bottom: 0.2rem; }
.rs-kind { margin: 1.1rem 0 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 0.5rem; }
@media (min-width: 600px) { .rs-kind { grid-template-columns: 1fr 1fr; } }
.rs-kind legend, .rs-label { padding: 0; margin-bottom: 0.5rem; font-size: 1rem; font-weight: 700; color: var(--ink); }
.rs-kind label {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 52px; padding: 0.6rem 0.9rem;
  border: 1px solid var(--line); background: var(--paper-warm);
  font-size: 1rem; line-height: 1.4; color: var(--ink-2);
  cursor: pointer;
}
.rs-kind label:has(input:checked) { border-color: var(--gold-ink); background: var(--champagne); color: var(--ink); }
.rs-kind input { flex: none; width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--gold-ink); }
.rs-label { display: block; margin-top: 1.3rem; }
.rs-mm { display: flex; align-items: center; gap: 0.6rem; }
.rs-mm input {
  width: 8.5rem; height: 54px; padding: 0 0.9rem;
  border: 1.5px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
  font: 600 1.4rem/1 var(--font-body);
}
.rs-mm input::placeholder { color: #8A8A8A; font-weight: 400; }
.rs-mm span { font-weight: 600; color: var(--ink-2); }
.rs-msg p {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: var(--paper-warm);
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.6;
}
.rs-calc .rs-dims, .rs-calc .rs-note { color: var(--ink-2); }

/* ---- Ring size circles (#circles) -------------------------------------
   On screen each circle is var(--d) x var(--rs-mm) across. js/ring-size.js
   sets --rs-mm to this screen's pixels per mm, so the circles are real size
   once the screen is set up; without JavaScript they use the browser's 1mm.
   When the page is printed (the Print button or the browser's own Print),
   only this section prints, in real mm; the 5 cm line lets people check. */
.rs-sheet { --rs-mm: 1mm; }
#circles { scroll-margin-top: var(--header-h); }
.rs-print-only, .rs-sheet [hidden] { display: none; }
.rs-scale {
  max-width: 46rem; margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: var(--paper-warm);
  color: var(--ink-2); font-size: 1rem; line-height: 1.6;
}
html:not(.js) .rs-scale { display: none; }
.rs-swipe { display: none; }

.rs-circles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(6.8rem, calc(23.5 * var(--rs-mm))), 1fr));
  gap: 0.6rem;
  margin-top: clamp(1.4rem, 3vw, 2rem); padding: 0; list-style: none;
}
.rs-circles li {
  display: grid; grid-template-rows: calc(22.6 * var(--rs-mm)) auto auto;
  justify-items: center; align-items: center; align-content: start;
  padding: 0.6rem 0.3rem 0.7rem;
  border: 1px solid transparent;
  text-align: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.rs-c {
  display: flex; align-items: center; justify-content: center;
  width: calc(var(--d) * var(--rs-mm)); height: calc(var(--d) * var(--rs-mm));
  border: 1px solid var(--gold-ink); border-radius: 50%;
  background: var(--paper);
  font-size: 1rem; font-weight: 700; line-height: 1; color: var(--ink);
}
.rs-circles b { margin-top: 0.5rem; font-size: 0.95rem; line-height: 1.3; color: var(--ink); }
.rs-circles small { font-size: 0.85rem; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
.rs-circles li.is-match { background: var(--champagne); border-color: var(--gold-ink); }
.rs-circles li.is-match .rs-c { background: var(--gold-soft); }

/* Phones: one row to swipe through instead of a very long list. */
@media (max-width: 599px) {
  .rs-swipe { display: block; margin-top: 1rem; font-size: 0.92rem; color: var(--ink-2); }
  .rs-circles {
    display: flex; gap: 0.4rem;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    margin-top: 0.6rem; margin-inline: calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 0.6rem; scroll-padding-inline: var(--gutter);
  }
  .rs-circles li { flex: none; width: max(6.8rem, calc(23.5 * var(--rs-mm))); scroll-snap-align: start; }
}
.rs-sheet__actions .rs-print { margin-top: clamp(1.4rem, 3vw, 2rem); }

@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  body > :not(main), main > :not(.rs-sheet) { display: none !important; }

  .rs-sheet, .rs-circles { --rs-mm: 1mm !important; }
  .rs-sheet { display: block; padding: 0 !important; background: none !important; color: #000; font-family: var(--font-body); font-size: 10pt; line-height: 1.4; }
  .rs-sheet .container { max-width: none; padding: 0; }
  .rs-sheet .rs-print-only { display: block; }
  .rs-screen-only { display: none !important; }
  .rs-sheet p, .rs-sheet li { max-width: none; }
  .rs-sheet__brand { font-size: 9pt; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
  .rs-sheet h2 { margin-top: 1mm; font-family: var(--font-display); font-size: 20pt; line-height: 1.2; color: #000; }
  .rs-sheet__contact { margin-top: 1mm; font-size: 9pt; }
  .rs-sheet__how { list-style: decimal; margin-top: 4mm; padding-left: 5mm; }
  .rs-sheet__how li + li { margin-top: 1mm; }

  .rs-check { margin-top: 5mm; height: 9mm; }
  .rs-check__bar { position: relative; display: block; width: 50mm; height: 4mm; margin-left: 2mm; border-bottom: 0.3mm solid #000; }
  .rs-check__bar i { position: absolute; bottom: -0.3mm; width: 0; height: 4.3mm; margin-left: -0.15mm; border-left: 0.3mm solid #000; }
  .rs-check__bar i:nth-of-type(1) { left: 0; }
  .rs-check__bar i:nth-of-type(2) { left: 10mm; height: 2.8mm; }
  .rs-check__bar i:nth-of-type(3) { left: 20mm; height: 2.8mm; }
  .rs-check__bar i:nth-of-type(4) { left: 30mm; height: 2.8mm; }
  .rs-check__bar i:nth-of-type(5) { left: 40mm; height: 2.8mm; }
  .rs-check__bar i:nth-of-type(6) { left: 50mm; }
  .rs-check__bar b { position: absolute; top: 5mm; font-size: 8pt; line-height: 1; transform: translateX(-50%); white-space: nowrap; }
  .rs-check__bar b:nth-of-type(1) { left: 0; }
  .rs-check__bar b:nth-of-type(2) { left: 50mm; }

  .rs-circles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3mm 2mm; margin: 5mm 0 0; padding: 0; overflow: visible; }
  .rs-circles li { width: auto; grid-template-rows: 23mm auto auto; padding: 0; border: 0 !important; background: none !important; break-inside: avoid; }
  .rs-c { border: 0.25mm solid #000; background: none !important; font-size: 11pt; color: #000; }
  .rs-circles b { margin-top: 1mm; font-size: 9pt; line-height: 1.2; color: #000; }
  .rs-circles small { font-size: 7.5pt; line-height: 1.2; color: #333; white-space: normal; }
  .rs-sheet__key { margin-top: 4mm; font-size: 9pt; }
}
