/* ---------------------------------------------------------------------------
   Page compositions — how the components are arranged on each of the five
   screens, plus the authenticated journal screens.
   --------------------------------------------------------------------------- */

/* ============================================================== Home ===== */
.hero {
  padding: var(--section-y) 0;
  background: var(--surface-paper);
  border-bottom: var(--border-1) solid var(--border-paper);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-8);
  align-items: center;
}
.hero__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: flex-start;
}
.hero__title {
  font: var(--type-display);
  color: var(--green-800);
  margin: 0;
}
.hero__lead {
  margin: 0;
  font: var(--type-lead);
  max-width: 46ch;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.hero__media { display: flex; justify-content: center; }
.hero__media img {
  max-height: 460px;
  width: auto;
  filter: drop-shadow(0 30px 40px rgba(36, 22, 9, 0.22));
}

.home-products { margin-top: var(--space-7); }
.home-quote { margin-top: var(--space-8); max-width: 52ch; }
.home-process { margin-top: var(--space-7); }
.home-process-note {
  margin: var(--space-6) 0 0;
  font: var(--type-small);
  font-family: var(--font-sans);
  color: var(--text-muted);
  max-width: 64ch;
}

/* ============================================================= About ===== */
.about__layout {
  display: grid;
  grid-template-columns: minmax(0, var(--container-narrow)) 1fr;
  gap: var(--space-8);
  align-items: start;
}
.about__body p { color: var(--text-body); }
.about__body p:first-child { font: var(--type-lead); }
.about__closing { margin-top: var(--space-6); }
.about__rail {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
}
/* The three renders that close the About page. Leaf-cut corners and the same
   label-paper field the product cards use, but no price and no CTA. */
.about-products { margin-top: var(--space-7); }
.about-product {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
}
/* Label paper behind the render, exactly as ProductCard does — the renders
   carry their own warm-neutral backdrop, which reads as a floating grey box on
   a white field but sits down quietly on cream. */
.about-product__media {
  padding: var(--space-5);
  border: var(--border-1) solid var(--border-hairline);
  border-radius: var(--shape-leaf-soft);
  background: var(--surface-subtle);
}
.about-product__media img {
  width: 100%;
  height: 260px;
  object-fit: contain;
}
.about-product__caption {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.about-product__name { font: var(--type-h3); color: var(--text-heading); }
.about-product__variant,
.about-product__size {
  font: var(--type-label);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.about-product__variant { color: var(--text-accent); }
.about-product__size { color: var(--text-muted); }

/* =========================================================== Startup ===== */
.startup__stats { margin-top: var(--space-7); }
.startup__phases { margin-top: var(--space-7); }
.startup__prose p { color: var(--text-body); }
.startup__prose p:last-child { margin-bottom: 0; }
/* The opening paragraph carries the news; it is set one step up, as the About
   page does with its first paragraph. */
.startup__lead { font: var(--type-lead); }
.milestone {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}
.milestone__title { font: var(--type-h3); }
.milestone__body { margin: 0; }
.startup__asks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: center;
}
.startup__asks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
}

/* Institutional support strip. The two partner marks are third-party property:
   shown at their supplied colours, never tinted, never on a coloured field.
   Label paper gives them a quiet plaque to sit on, and the heights below match
   their optical weight rather than their raw pixel size — the ministry lockup is
   a tall portrait drawing, Startup Albania a wide horizontal one. */
.support {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}
.support__logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  /* Two separate institutions, not one lockup: they need a clear gap. The
     ministry mark is wider at its wordmark than at its drawing, which eats into
     the optical gap, so this is set generously. */
  gap: var(--space-9);
  margin-top: var(--space-4);
}
.support__logo { width: auto; }
/* Heights are matched by optical weight, not pixel size. The ministry lockup is
   fine line art with a wordmark under it and needs the extra height to stay
   legible; Startup Albania is solid and reads heavy at a much smaller size. */
.support__logo--ministry { height: 150px; }
.support__logo--startup { height: 54px; }
/* The official funding statement. Bold, because it is a formal attribution
   rather than running copy. */
.support__note {
  max-width: 62ch;
  margin: var(--space-2) 0 0;
  font: var(--type-lead);
  font-weight: var(--weight-bold);
  color: var(--text-body);
  text-wrap: pretty;
}

/* =========================================================== Journal ===== */
.journal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
}
.journal__admin {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
  flex: 0 0 auto;
}
.journal__guest-note {
  max-width: 24ch;
  text-align: right;
  font: var(--type-small);
  font-family: var(--font-sans);
  color: var(--text-muted);
}
.journal__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.journal__list { display: flex; flex-direction: column; }
.journal__empty { color: var(--text-muted); }

/* A post row: leaf-cut corners, lifting to white paper on hover. */
.post-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: var(--space-6);
  align-items: start;
  padding: var(--space-5);
  border: var(--border-1) solid transparent;
  border-radius: var(--shape-leaf-soft);
  background: transparent;
  transition: var(--transition-interactive);
}
.post-row:hover,
.post-row:focus-within {
  background: var(--white);
  border-color: var(--border-hairline);
  box-shadow: var(--shadow-sm);
}
.post-row__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}
.post-row__date {
  font: var(--type-label);
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.post-row__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.post-row__title { font: var(--type-h3); color: var(--text-heading); transition: var(--transition-interactive); }
.post-row__title a { color: inherit; border-bottom: none; }
.post-row:hover .post-row__title,
.post-row:focus-within .post-row__title { color: var(--orange-600); }
.post-row__excerpt { margin: 0; max-width: 62ch; }
.post-row__action { align-self: center; }

.journal__pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--border-1) solid var(--border-hairline);
}
.journal__page-count {
  font: var(--type-label);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ======================================================== Post detail ==== */
.post-detail { max-width: var(--container-narrow); }
.post-detail__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.post-detail__title { font: var(--type-h1); margin-bottom: var(--space-4); }
.post-detail__lead { font: var(--type-lead); color: var(--text-body); }
.post-detail__body p { color: var(--text-body); }
.post-detail__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--border-1) solid var(--border-hairline);
}
.post-related { margin-top: var(--space-7); }

/* ============================================================= Order ===== */
.order__layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: var(--space-8);
  align-items: start;
}
.order__form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
/* One row per product: name and pack size on the left, a quantity box on the
   right. Zero means "not ordering this one", so no add/remove buttons are
   needed and the form works with JavaScript off. */
.order__products {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-5);
  border: var(--border-1) solid var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
}
.order__products legend { padding: 0 var(--space-2); }
.order__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.order__line + .order__line { padding-top: var(--space-3); border-top: var(--border-1) solid var(--border-hairline); }
.order__line-label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.order__line-name { font: var(--type-body); font-family: var(--font-sans); font-weight: var(--weight-medium); color: var(--text-heading); }
.order__line-size {
  font: var(--type-label);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.order__line-qty { width: 92px; flex: 0 0 auto; text-align: center; }
.order__confirmed-lines {
  margin: 0;
  padding-left: var(--space-5);
  font: var(--type-body);
  color: var(--text-body);
}

.order__checks {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.order__submit {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}
.order__contact {
  font: var(--type-small);
  font-family: var(--font-sans);
  color: var(--text-muted);
}
.order__rail {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}
/* The selected product's render, at the head of the rail. Fixed height with
   object-fit so swapping between the sack and the bottles never shifts the
   column; label paper behind it, as everywhere else the renders appear. */
.order__rail-media {
  padding: var(--space-5);
  border: var(--border-1) solid var(--border-hairline);
  border-radius: var(--shape-leaf-soft);
  background: var(--surface-subtle);
}
.order__rail-media img {
  width: 100%;
  height: 260px;
  object-fit: contain;
}
.order__rail-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font: var(--type-small);
  font-family: var(--font-sans);
  color: var(--cream-100);
}
.order__rail-line .ds-icon { color: var(--orange-300); }
.order__summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border-1) solid rgba(36, 22, 9, 0.14);
}
.order__summary-total {
  font: var(--weight-bold) var(--text-xl) / 1.2 var(--font-display);
  color: var(--green-800);
}
.order__confirmation {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-5) 0;
}
.order__reference {
  font: var(--type-packaging);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  color: var(--green-800);
}

/* ----------------------------------------------- Collaboration form ----- */
.collab__layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--space-8);
  align-items: start;
}
.collab__intro { display: flex; flex-direction: column; gap: var(--space-5); }
.collab__points {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.collab__points li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font: var(--type-body);
  color: var(--text-body);
}
.collab__points .ds-icon { color: var(--green-700); margin-top: 3px; }
.collab__form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }

/* ------------------------------------------------------------- Map ------ */
/* Leaf-cut corners and a hairline, so the embed sits inside the system rather
   than looking pasted on. */
.map {
  overflow: hidden;
  border: var(--border-1) solid var(--border-hairline);
  border-radius: var(--shape-leaf-soft);
  background: var(--surface-subtle);
  box-shadow: var(--shadow-sm);
}
.map__frame {
  display: block;
  width: 100%;
  height: 420px;
  border: 0;
}

/* ====================================================== Auth & admin ===== */
.auth {
  display: flex;
  justify-content: center;
  padding: var(--section-y) 0;
}
.auth__panel { width: min(440px, 100%); }
.auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

/* The admin screens open on a plain band of label paper — decoration only,
   with the page heading carried invisibly for assistive technology. */
.admin__banner { height: var(--space-8); padding: 0; }

/* Categories and products: the form beside the list, so adding one does not
   push the table off the screen. The two screens share these rules by aliasing
   rather than duplicating, so a later tweak to one cannot drift from the other
   — they are the same screen with different fields. */
.categories__layout,
.products__layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.categories__form,
.products__form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.categories__form .ds-field--wide,
.products__form .ds-field--wide { grid-column: 1 / -1; }
.categories__row--editing { background: var(--surface-subtle); }

/* The photo comes first in the panel and LAST in the markup — see the comment
   on the field in products.ejs. Moving it visually is this one line; moving it
   in the markup would lose _csrf and every typed value whenever the upload
   trips multer's size limit. */
.products__file-field { order: -1; }
/* A file input is not a text input: .ds-input's fixed height crops the
   browser's own "Choose file" button, so let it size itself. */
.products__file { height: auto; padding: var(--space-3); }
.products__preview { margin: 0 0 var(--space-3); display: grid; gap: var(--space-2); justify-items: start; }
.products__preview img { width: 120px; height: 96px; object-fit: contain; }
/* `max-width: none` is load-bearing, not tidying. The base `img` rule sets
   max-width: 100%, which inside a table cell resolves against a width that
   itself depends on the cell's content — a circle the browser settles at 0, so
   the thumbnail disappears entirely while still reporting as loaded. */
.products__thumb {
  width: 56px;
  height: 44px;
  max-width: none;
  object-fit: contain;
  display: block;
}

.admin__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.admin__tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
/* The badge counts the whole table, not just the new arrivals: a new-only
   number vanishes the moment the work is marked handled, which is exactly when
   the operator still wants to see how much is in there. `data-attention` tints
   the numeral — not the pill, which the active state already paints green — so
   a tab holding untouched entries stands out wherever it sits. */
.admin__tab-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ds-tag[data-attention="true"] .admin__tab-count { color: var(--text-accent); }
/* On the open tab the pill is filled green, so the accent has to lighten
   rather than darken to stay legible. */
.ds-tag[aria-current="true"] .admin__tab-count { color: var(--cream-100); }
.ds-tag[aria-current="true"][data-attention="true"] .admin__tab-count { color: var(--orange-300); }
.admin__table {
  width: 100%;
  border-collapse: collapse;
  font: var(--type-small);
  font-family: var(--font-sans);
}
.admin__table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font: var(--type-label);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: var(--border-1) solid var(--border-hairline);
  white-space: nowrap;
}
.admin__table td {
  padding: var(--space-4);
  border-bottom: var(--border-1) solid var(--border-hairline);
  vertical-align: top;
  color: var(--text-body);
}
.admin__table tr:last-child td { border-bottom: none; }
/* `position: relative` is not decoration. The visually-hidden column headings
   are position:absolute, so without a positioned ancestor here their
   containing block is the page, not this box — and `overflow-x` does not clip
   an absolutely positioned descendant it is not the containing block for. On a
   table wide enough to scroll (products, with its nine columns) those 1px
   spans landed outside the viewport and gave the whole PAGE a horizontal
   scrollbar, while the table's own one worked perfectly. */
.admin__table-scroll { overflow-x: auto; position: relative; }
/* An order's products, one per line, quantity first so the column scans. */
.admin__lines { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.admin__lines li { display: flex; gap: var(--space-2); align-items: baseline; }
.admin__lines-qty { font-weight: var(--weight-bold); color: var(--text-heading); white-space: nowrap; }

.admin__row-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.admin__row-actions .ds-btn { white-space: nowrap; }
.admin__post-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-5);
}
.admin__post-form .ds-field--wide { grid-column: 1 / -1; }
.admin__fieldset {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  margin: 0;
  padding: var(--space-5);
  border: var(--border-1) solid var(--border-hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-page);
}
.admin__legend {
  padding: 0 var(--space-2);
  font: var(--type-label);
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--green-800);
}
.admin__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.admin__inline-form { display: inline; }

/* ====================================================== Error screens ==== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--section-y) 0;
  max-width: 56ch;
}
.error-page__code {
  font: var(--weight-black) var(--text-5xl) / 1 var(--font-display);
  color: var(--green-700);
}
.error-page__detail {
  width: 100%;
  overflow-x: auto;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  font: var(--type-small);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-600);
  white-space: pre-wrap;
}

/* ======================================================= Breakpoints ===== */
@media (max-width: 1080px) {
  .about__layout { grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-7); }
  .order__layout { grid-template-columns: 1.2fr 0.8fr; gap: var(--space-7); }
}

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-7); }
  .hero__media { order: -1; }
  .hero__media img { max-height: 320px; }
  .hero__title { font-size: var(--text-3xl); }

  .about__layout,
  .order__layout,
  .collab__layout,
  .startup__asks { grid-template-columns: minmax(0, 1fr); }
  .about__rail { position: static; }
  .order__rail-media { max-width: 360px; }

  .post-row { grid-template-columns: 140px 1fr; }
  .post-row__action { grid-column: 2; justify-self: start; align-self: start; }

  .admin__post-form { grid-template-columns: minmax(0, 1fr); }
  .categories__layout,
  .products__layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .hero { padding: var(--section-y-tight) 0; }
  .journal__head { flex-direction: column; }
  .journal__admin { align-items: flex-start; }
  .journal__guest-note { text-align: left; }
  .support__logos { gap: var(--space-7); }
  .support__logo--ministry { height: 116px; }
  .support__logo--startup { height: 44px; }

  .order__form,
  .collab__form { grid-template-columns: minmax(0, 1fr); }
  .map__frame { height: 320px; }
  .post-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .post-row__action { grid-column: 1; }
  .journal__pagination { flex-wrap: wrap; }
}
