/* =========================================================================
   CARAT POS — Receipt Roll
   Aesthetic: thermal-paper / ledger / official-document
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&family=Noto+Serif+Armenian:wght@400;500;700&family=Noto+Sans+Mono:wght@400;500;700&display=swap');

:root {
  --paper:        #f4f0e8;
  --paper-shade:  #ece7dc;
  --paper-fade:   #e3ddcd;
  --ink:          #0a0a0a;
  --ink-soft:     #2a2a26;
  --ink-mute:     #6a6a64;
  --ink-faint:    #a8a59c;
  --rule:         #1a1a18;
  --accent:       #0d4e44;
  --accent-soft:  #b9d6cf;
  --stamp:        #b13322;

  --mono: "JetBrains Mono", "Noto Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Source Serif 4", "Noto Serif Armenian", Georgia, "Times New Roman", serif;

  --w-receipt: 720px;
  --w-wide:    1100px;

  --gap-xs:  6px;
  --gap-sm:  12px;
  --gap-md:  20px;
  --gap-lg:  40px;
  --gap-xl:  72px;
}

/* ─── Reset & base ────────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.62;
  font-feature-settings: "ss01", "kern", "liga";
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Paper grain — subtle SVG noise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Faint vertical edge fade — like paper edge shadow */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(10,10,8,0.06) 0%, transparent 4%, transparent 96%, rgba(10,10,8,0.06) 100%);
}

/* ─── i18n visibility ──────────────────────────────────────────────────
   Hide non-matching [lang] descendants. We do NOT show-rule the matching
   language — we let its natural author styles flow through. This avoids
   `display: revert` overriding deliberately-set display values
   (e.g. .hero__meta span strong { display: block }).
   The selectors below use html[data-lang][lang] which has specificity
   (0,3,2) — higher than typical class+element author selectors. */

html[data-lang="hy"] [lang]:not([lang="hy"]):not(html),
html[data-lang="ru"] [lang]:not([lang="ru"]):not(html),
html[data-lang="en"] [lang]:not([lang="en"]):not(html) {
  display: none !important;
}

html[data-lang="hy"] body { font-family: "Noto Serif Armenian", "Source Serif 4", serif; }
html[data-lang="hy"] .mono,
html[data-lang="hy"] h1, html[data-lang="hy"] h2, html[data-lang="hy"] h3,
html[data-lang="hy"] .stat__value, html[data-lang="hy"] .stat__label {
  font-family: "Noto Sans Mono", "JetBrains Mono", monospace;
}

/* ─── Typography primitives ──────────────────────────────────────────── */

.mono { font-family: var(--mono); letter-spacing: 0.01em; }
.serif { font-family: var(--serif); }

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 { font-size: clamp(48px, 9vw, 120px); letter-spacing: -0.04em; }
h2 { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: 0.02em; text-transform: uppercase; }
h3 { font-size: clamp(16px, 1.4vw, 18px); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; }

p { max-width: 62ch; }
p + p { margin-top: 1em; }

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  padding: 0 1px;
}
a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ─── Layout ─────────────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}

.receipt {
  max-width: var(--w-receipt);
  margin: 0 auto;
}

/* ─── Header / lang switcher ────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px clamp(20px, 5vw, 64px);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.brand__mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--stamp);
  transform: rotate(45deg);
  margin-right: 4px;
}
.brand__sub { color: var(--ink-mute); font-weight: 400; letter-spacing: 0.08em; }

.lang {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule);
}
.lang button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
}
.lang button:last-child { border-right: 0; }
.lang button:hover { background: var(--paper-shade); }
.lang button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ─── Section: hero (receipt header) ────────────────────────────────── */

.hero {
  padding: clamp(48px, 10vh, 96px) 0 clamp(40px, 6vh, 64px);
}

.hero__meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--rule);
}
.hero__meta span strong {
  display: block;
  color: var(--ink);
  font-weight: 700;
  margin-top: 4px;
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero__title .line {
  display: inline-block;
  border-bottom: 4px solid var(--ink);
  padding-bottom: 6px;
}

.hero__lede {
  margin-top: 36px;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.4;
  font-family: var(--serif);
  font-weight: 500;
  max-width: 30ch;
}

.hero__stamp {
  position: absolute;
  right: 8%;
  top: 38%;
  transform: rotate(-12deg);
  border: 3px solid var(--stamp);
  color: var(--stamp);
  padding: 8px 18px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.22em;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.78;
  pointer-events: none;
  white-space: nowrap;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--stamp);
}
.hero__stamp::before {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid var(--stamp);
  opacity: 0.5;
  border-radius: 2px;
}

@media (max-width: 720px) {
  .hero__stamp { right: 4%; top: auto; bottom: -8%; font-size: 11px; padding: 6px 12px; }
}

/* ─── Cut-line dividers ─────────────────────────────────────────────── */

.cut {
  position: relative;
  height: 24px;
  margin: 0;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  background:
    radial-gradient(circle at 0 50%, transparent 12px, var(--paper) 13px),
    radial-gradient(circle at 100% 50%, transparent 12px, var(--paper) 13px);
}

.cut--scissors::after {
  content: "✂";
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  font-size: 14px;
  background: var(--paper);
  padding: 0 8px;
  color: var(--ink-mute);
}

/* ─── Sections ──────────────────────────────────────────────────────── */

section {
  padding: clamp(48px, 8vh, 96px) 0;
  position: relative;
}

.section__head {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  margin-bottom: 48px;
  align-items: baseline;
}
.section__head .num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .section__head { grid-template-columns: 1fr; gap: 12px; margin-bottom: 32px; }
}

/* ─── About / description block ─────────────────────────────────────── */

.prose {
  font-family: var(--serif);
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 64ch;
}
.prose p { max-width: none; }
.prose strong { color: var(--ink); font-weight: 600; }

.lede {
  font-size: clamp(20px, 1.7vw, 24px);
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
  max-width: 56ch;
  margin-bottom: 28px;
}

/* ─── Capabilities ledger ───────────────────────────────────────────── */

.ledger {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 14px;
}
.ledger__row {
  display: grid;
  grid-template-columns: 60px 1fr 2.4fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--paper-fade);
  align-items: baseline;
}
.ledger__row:last-child { border-bottom: 0; }
.ledger__row:hover { background: var(--paper-shade); }

.ledger__num {
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.16em;
}
.ledger__key {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 13px;
}
.ledger__desc {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .ledger__row { grid-template-columns: 1fr; gap: 4px; padding: 16px 0; }
  .ledger__num { font-size: 10px; }
}

/* ─── Stat slabs ────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 2px solid var(--ink);
  background: var(--ink);
}
.stat {
  background: var(--paper);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.stat:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  right: 0;
  width: 1px;
  background: var(--paper-fade);
}
.stat__value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.stat__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 8px;
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2)::after { display: none; }
}

/* ─── MFG INFO / metadata block ─────────────────────────────────────── */

.mfg {
  background: var(--paper-shade);
  border: 1px solid var(--rule);
  padding: 32px;
  font-family: var(--mono);
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 32px;
}
.mfg dt {
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}
.mfg dd {
  font-weight: 500;
  color: var(--ink);
}

@media (max-width: 720px) {
  .mfg { grid-template-columns: 1fr; padding: 24px; }
}

/* ─── Operator card ─────────────────────────────────────────────────── */

.operator {
  border: 2px solid var(--ink);
  padding: 40px;
  background: var(--paper);
  position: relative;
}
.operator::before {
  content: "OPERATOR / ՕՊԵՐԱՏՈՐ / ОПЕРАТОР";
  position: absolute;
  top: -10px;
  left: 24px;
  background: var(--paper);
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}
.operator__name {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.operator__addr {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.operator__contact {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--rule);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
  font-family: var(--mono);
  font-size: 13px;
}
.operator__contact dt {
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .operator { padding: 32px 24px; }
  .operator__contact { grid-template-columns: 1fr; }
}

/* ─── Barcode footer ────────────────────────────────────────────────── */

.barcode {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1px;
  height: 60px;
  padding: 24px 0 12px;
}
.barcode span {
  display: inline-block;
  width: 2px;
  background: var(--ink);
  height: 100%;
}
.barcode__num {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--ink-mute);
  padding-bottom: 12px;
}

/* ─── Footer ────────────────────────────────────────────────────────── */

.foot {
  border-top: 2px solid var(--ink);
  padding: 48px 0 64px;
  margin-top: 48px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}
.foot__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 48px;
}
.foot h4 {
  font-size: 11px;
  letter-spacing: 0.18em;
  margin-bottom: 14px;
  color: var(--ink);
}
.foot ul { list-style: none; }
.foot ul li { margin-bottom: 6px; }
.foot a {
  border-bottom: 0;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.foot a:hover {
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}
.foot__sign {
  text-align: center;
  padding-top: 32px;
  border-top: 1px dashed var(--rule);
  letter-spacing: 0.32em;
  font-size: 10px;
  text-transform: uppercase;
}
.foot__sign::before, .foot__sign::after {
  content: " === ";
  color: var(--ink-faint);
}

@media (max-width: 720px) {
  .foot__grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ─── Legal page (privacy/terms) ────────────────────────────────────── */

.doc {
  max-width: var(--w-receipt);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 80px) 0;
}
.doc__head {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 24px;
  margin-bottom: 40px;
}
.doc__kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 16px;
}
.doc__title {
  font-family: var(--mono);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.doc__meta {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.doc__body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.doc__body h2 {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 48px 0 16px;
  padding-top: 24px;
  border-top: 1px dashed var(--rule);
  color: var(--ink);
}
.doc__body h2 .num {
  display: inline-block;
  width: 36px;
  color: var(--ink-mute);
  font-weight: 400;
}
.doc__body h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.doc__body p { max-width: none; }
.doc__body p + p { margin-top: 16px; }
.doc__body ul {
  margin: 16px 0 16px 28px;
}
.doc__body ul li {
  margin-bottom: 8px;
  list-style: none;
  position: relative;
}
.doc__body ul li::before {
  content: "—";
  position: absolute;
  left: -28px;
  color: var(--ink-mute);
}
.doc__body strong { color: var(--ink); font-weight: 600; }

.doc__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 0;
  color: var(--ink-mute);
}
.doc__back:hover {
  background: transparent;
  color: var(--ink);
}
.doc__back::before { content: "←"; }

/* ─── Reveal animation ──────────────────────────────────────────────── */

@keyframes rollDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
  }
}

.reveal {
  animation: rollDown 0.8s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

.reveal:nth-child(1) { animation-delay: 0.05s; }
.reveal:nth-child(2) { animation-delay: 0.15s; }
.reveal:nth-child(3) { animation-delay: 0.25s; }
.reveal:nth-child(4) { animation-delay: 0.35s; }
.reveal:nth-child(5) { animation-delay: 0.45s; }
.reveal:nth-child(6) { animation-delay: 0.55s; }

/* ─── Print styles ──────────────────────────────────────────────────── */

@media print {
  body::before, body::after { display: none; }
  .topbar, .lang, .foot__grid, .barcode { display: none; }
  body { background: white; color: black; }
  .hero__stamp { opacity: 0.4; }
  section, .doc { page-break-inside: avoid; padding: 16px 0; }
}

/* ─── Reduced motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
