/* ============================================================
   ArhivaDoc - architectural hand-drawn poster
   cream paper · black ink linework · terracotta roofs · olive labels
   ============================================================ */

:root {
  --cream:      #E6DBD7;
  --cream-hi:   #EFE7E3;
  --paper:      #FBF7F4;
  --ink:        #1a1a1a;
  --pine:       #273F33;
  --terra:      #D77259;
  --terra-deep: #BC5346;
  --olive:      #A8B545;
  --straw:      #D9C84A;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body:    "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --wrap: 1180px;
  --hairline: 1.5px solid var(--ink);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

/* paper grain over everything, very subtle */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--straw); color: var(--ink); }

:focus-visible {
  outline: 2.5px solid var(--terra-deep);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  background: var(--ink);
  color: var(--cream);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 0.75rem; }

/* ---------- layout primitives ---------- */
.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}
.section {
  padding-block: clamp(4.5rem, 9vw, 8rem);
  position: relative;
}

/* ---------- typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 5.6vw, 4.4rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); max-width: 22ch; }
h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.2; }

.lede {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  max-width: 46ch;
  margin-top: 1.4rem;
}
.lede--small { font-size: 1.05rem; }

/* hand-drawn scribble underline - wobbly stroke, slight rotations */
.scribble {
  position: relative;
  white-space: nowrap;
}
.scribble::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.12em;
  height: 0.28em;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transform: rotate(-0.8deg);
  pointer-events: none;
}
.scribble--terra::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 22' preserveAspectRatio='none'%3E%3Cpath d='M4 14 C 40 6, 80 18, 118 10 S 190 8, 216 12' fill='none' stroke='%23D77259' stroke-width='6' stroke-linecap='round' opacity='0.75'/%3E%3C/svg%3E");
}
.scribble--olive::after {
  transform: rotate(0.7deg) scaleY(0.9);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 22' preserveAspectRatio='none'%3E%3Cpath d='M4 11 C 46 17, 90 5, 130 13 S 196 16, 216 9' fill='none' stroke='%23A8B545' stroke-width='6' stroke-linecap='round' opacity='0.8'/%3E%3C/svg%3E");
}

/* mono tags / labels */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.42em 0.9em;
  border: var(--hairline);
  background: var(--olive);
  color: var(--ink);
  transform: rotate(-1.2deg);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  margin-bottom: 1.4rem;
}
.tag--olive { background: var(--olive); }
.tag--straw { background: var(--straw); transform: rotate(0.9deg); }
.tag--terra { background: var(--terra); color: var(--ink); transform: rotate(-0.7deg); }

.section-head { margin-bottom: clamp(2.5rem, 5vw, 4rem); }

/* ---------- buttons: solid ink, sharp corners, mono ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cream);
  background: var(--ink);
  border: var(--hairline);
  padding: 0.95em 1.6em;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(26, 26, 26, 0.22);
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out),
              transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.btn:hover {
  background: var(--terra);
  color: var(--ink);
  transform: translate(-1.5px, -1.5px);
  box-shadow: 6px 6px 0 rgba(26, 26, 26, 0.28);
}
.btn:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(26,26,26,0.25); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 6px 6px 0 rgba(26, 26, 26, 0.2);
}
.btn--small { padding: 0.62em 1.1em; font-size: 0.7rem; box-shadow: 3px 3px 0 rgba(26,26,26,0.2); }
.arrow { display: inline-block; margin-left: 0.4em; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: var(--hairline);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}
.wordmark-mark { width: 30px; height: 30px; }
.wordmark-text {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.wordmark-text em { font-style: normal; color: var(--terra-deep); }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
}
.site-nav > a:not(.btn) {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  position: relative;
  padding-block: 0.2em;
  white-space: nowrap;
}
.site-nav .btn { white-space: nowrap; }
.site-nav > a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -0.15em;
  border-bottom: 2px solid var(--terra);
  transition: right 0.22s var(--ease-out);
}
.site-nav > a:not(.btn):hover::after { right: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: var(--hairline);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  padding-block: clamp(3rem, 7vw, 6rem) clamp(4rem, 8vw, 7rem);
  border-bottom: var(--hairline);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.2rem;
}
.hero-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pine);
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(26, 26, 26, 0.5);
}

.hero-figure { max-width: 640px; justify-self: end; width: 100%; }
.figure-caption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pine);
  margin-top: 0.9rem;
  padding-left: 0.8rem;
  border-left: 3px solid var(--terra);
}

/* SVG text styles */
.svg-label {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 4px;
  fill: var(--ink);
}
.svg-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.5px;
  fill: var(--ink);
}
.svg-mono--dim { fill: var(--pine); font-size: 10.5px; }
.svg-mono--dark { fill: var(--ink); font-weight: 500; }

/* hero SVG stroke draw-in (JS adds .can-draw to <html>) */
.can-draw #hero-svg .draw:not(.dash) {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: svg-draw 1.1s var(--ease-out) forwards;
}
/* dashed annotation lines fade in instead, keeping their dash pattern */
.can-draw #hero-svg .draw.dash {
  opacity: 0;
  animation: dash-in 0.9s var(--ease-out) forwards;
}
#hero-svg .roof { animation-delay: 0.1s; }

@keyframes svg-draw { to { stroke-dashoffset: 0; } }
@keyframes dash-in { to { opacity: 1; } }

/* blinking status lights - kept subtle */
.blink { animation: blink-soft 3.2s ease-in-out infinite; }
.blink:nth-of-type(2) { animation-delay: 1.1s; }
.blink:nth-of-type(3) { animation-delay: 2.2s; }
@keyframes blink-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- problem ---------- */
.problem-list { border-top: var(--hairline); }
.problem-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding-block: clamp(1.6rem, 3vw, 2.4rem);
  border-bottom: var(--hairline);
}
.problem-no {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--terra-deep);
}
.problem-row p { max-width: 52ch; margin-top: 0.4rem; }
.problem-note {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pine);
  border: 1.5px dashed var(--pine);
  padding: 0.35em 0.8em;
  transform: rotate(1.4deg);
  white-space: nowrap;
}
.problem-row:nth-child(2) .problem-note { transform: rotate(-1.1deg); }

/* ---------- process (dark pine panel) ---------- */
.section--pine {
  background: var(--pine);
  color: var(--cream);
  border-block: var(--hairline);
}
.section--pine h2 { color: var(--cream); }
.section--pine .tag { border-color: var(--ink); }

.pipeline {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  counter-reset: step;
  position: relative;
}
/* dashed connector line behind the steps (desktop) */
.pipeline::before {
  content: "";
  position: absolute;
  top: 3.4rem;
  left: 4%;
  right: 4%;
  border-top: 2px dashed rgba(230, 219, 215, 0.45);
  pointer-events: none;
}
.pipe-step { position: relative; color: var(--cream); }
.pipe-figure {
  width: clamp(84px, 8vw, 110px);
  margin-bottom: 1.2rem;
  color: var(--cream);
  background: var(--pine);
  position: relative;
}
.pipe-no {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--straw);
  display: block;
  margin-bottom: 0.5rem;
}
.pipe-step h3 { color: var(--cream); margin-bottom: 0.6rem; }
.pipe-step p {
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(230, 219, 215, 0.82);
  max-width: 30ch;
}
.pipe-note {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pine);
  background: var(--straw);
  padding: 0.3em 0.7em;
  margin-top: 1rem;
  transform: rotate(-1deg);
}
.pipe-step:nth-child(even) .pipe-note { transform: rotate(1.2deg); }

/* ---------- documents ---------- */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: var(--hairline);
  border-left: var(--hairline);
}
.doc-tile {
  border-right: var(--hairline);
  border-bottom: var(--hairline);
  padding: clamp(1.4rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  background: transparent;
  transition: background 0.25s var(--ease-out);
}
.doc-tile:hover { background: var(--cream-hi); }
.doc-tile svg {
  width: clamp(96px, 9vw, 128px);
  margin-bottom: 1.4rem;
  color: var(--ink);
}
.doc-ro {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--terra-deep);
  margin-bottom: 0.45rem;
}
.doc-tile h3 { margin-bottom: 0.55rem; }
.doc-tile p:last-child { font-size: 0.92rem; line-height: 1.55; }

/* ---------- local-first ---------- */
.section--panel { background: var(--cream-hi); border-block: var(--hairline); }
.local-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: center;
}
.check-list {
  list-style: none;
  padding: 0;
  margin-top: 2rem;
  border-top: var(--hairline);
}
.check-list li {
  padding: 1.1rem 0 1.1rem 2.6rem;
  border-bottom: 1.5px dashed rgba(26, 26, 26, 0.45);
  position: relative;
  font-size: 0.97rem;
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 1.35rem;
  width: 1.2rem;
  height: 0.65rem;
  border-left: 2.5px solid var(--terra-deep);
  border-bottom: 2.5px solid var(--terra-deep);
  transform: rotate(-48deg) translateY(-2px);
}
.check-list strong { font-weight: 600; }
.local-figure svg { width: 100%; max-width: 420px; margin-inline: auto; color: var(--ink); }

/* ---------- funding ---------- */
.section--funding { border-bottom: var(--hairline); }
.funding-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
}
.funding-grid p + p { margin-top: 1.1rem; }
.funding-grid > div:last-child p {
  font-size: 1.02rem;
  max-width: 56ch;
}
.funding-grid strong { font-family: var(--font-mono); font-size: 0.92em; font-weight: 500; }

/* ---------- contact ---------- */
.section--contact { background: var(--cream); }
.contact-inner {
  max-width: 46rem;
}
.contact-inner .lede { margin-bottom: 0; }

/* ---------- footer ---------- */
.site-footer {
  border-top: var(--hairline);
  background: var(--ink);
  color: var(--cream);
  padding-block: 2.2rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer .wordmark-text { color: var(--cream); }
.site-footer .wordmark-text em { color: var(--terra); }
.footer-note {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(230, 219, 215, 0.65);
}

/* ---------- scroll reveal ---------- */
.can-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.can-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipeline::before { display: none; }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Romanian nav labels are longer than the English ones, so the
   menu collapses to the toggle earlier than the rest of the layout */
@media (max-width: 1280px) {
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--cream);
    border-bottom: var(--hairline);
    padding: 0.5rem 1.25rem 1.25rem;
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav > a:not(.btn) {
    width: 100%;
    padding-block: 0.85rem;
    border-bottom: 1px dashed rgba(26, 26, 26, 0.35);
    font-size: 0.85rem;
  }
  .site-nav .btn { margin-top: 1rem; }
  .nav-toggle { display: flex; }
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { justify-self: start; max-width: 560px; }
  .local-grid, .funding-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .doc-grid { grid-template-columns: 1fr; }
  .problem-row { grid-template-columns: 2.5rem 1fr; }
  .problem-note { grid-column: 2; justify-self: start; margin-top: 0.4rem; }
  .pipeline { grid-template-columns: 1fr; }
  .pipe-step p { max-width: none; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .can-draw #hero-svg .draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .can-reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
  .blink { animation: none; }
  .btn, .site-nav > a:not(.btn)::after { transition: none; }
}

/* language switcher, stamped label style */
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  margin-left: 18px;
  border: 1.5px solid #1a1a1a;
  background: #F4EFE9;
  flex: 0 0 auto;
}
.lang-opt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 5px 10px;
  color: #1a1a1a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.lang-opt.is-active {
  background: #D9C84A;
  font-weight: 500;
}
a.lang-opt:hover {
  background: #D77259;
  color: #E6DBD7;
}
@media (max-width: 1280px) {
  .lang-switch { margin-left: auto; margin-right: 14px; }
}
