/* ============================================================
   SwissMS Recycle — design tokens
   Palette: clean lab-white background, graphite ink, one accent
   (muted vermillion) used sparingly. Mono face nods to instrument
   readouts (timestamps, lab codes); grotesk display + humanist body.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
  --ink: #1b1f23;
  --ink-soft: #4a5157;
  --paper: #f7f7f5;
  --paper-raised: #ffffff;
  --line: #e2e2de;
  --accent: #c8443c;
  --accent-ink: #7a2a25;
  --accent-tint: #f6e6e4;
  --offer: #1b7a78;
  --offer-tint: #e5f2f1;
  --ion-blue: #3d6f99;
  --request: #c8443c;
  --request-tint: #f6e6e4;

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 31, 35, 0.04), 0 4px 16px rgba(27, 31, 35, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse 60% 50% at 25% 15%, rgba(200, 68, 60, 0.10), transparent 60%),
    radial-gradient(ellipse 55% 45% at 78% 55%, rgba(27, 122, 120, 0.09), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
}

.hero-figure {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
}

.person-tof-photo {
  display: block;
  height: 480px;
  width: auto;
}

.ion-overlay {
  position: absolute;
  left: 75.3%;
  top: 58.2%;
  width: 7.3%;
  height: 3.7%;
  pointer-events: none;
}

.ion-overlay--tower {
  left: 58%;
  top: 10%;
  width: 17%;
  height: 44%;
}

.hero-figure--sm {
  transform: scale(0.42);
  transform-origin: top center;
  margin-bottom: -290px;
  margin-top: -20px;
}

.brand-logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.cap {
  color: var(--accent);
}

.highlight-circle {
  position: absolute;
  top: -0.4em;
  left: -0.45em;
  width: calc(100% + 0.9em);
  height: calc(100% + 0.9em);
  pointer-events: none;
}

.page {
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: relative;
}

.hero-bg .container {
  position: relative;
  z-index: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-pill {
  border-radius: 999px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--ink-soft);
}

.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper-raised);
}
.btn-primary:hover { transform: translateY(-1px); }

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-sm { padding: 7px 12px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn-primary:hover, .btn-accent:hover { transform: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-tint);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 20px;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(40px, 6.5vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 auto 20px;
  max-width: 31ch;
}

.highlight {
  position: relative;
  display: inline-block;
  font-style: italic;
}

.lede {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Signature element: spectrum trace */
.spectrum {
  width: 100%;
  height: auto;
  margin-top: 48px;
  display: block;
}

/* ---------- How it works ---------- */
.section-divider {
  height: 24px;
  width: 33%;
  margin: 0 auto;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.section {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}

.section--noborder {
  border-top: none;
  padding-top: 32px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-head .index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 14px;
}

.tag-offer { background: var(--offer-tint); color: var(--offer); }
.tag-request { background: var(--request-tint); color: var(--request); }

.card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 8px;
}

.card p {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  color: var(--ink-soft);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Auth card (login.html) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 22px;
  max-width: none;
  margin: 0 0 6px;
  text-align: center;
}

.auth-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 24px;
  text-align: center;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink-soft);
  user-select: none;
}

.tab.active {
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--paper-raised);
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-msg {
  font-size: 13px;
  margin-top: 14px;
  min-height: 18px;
}

.form-msg.error { color: var(--accent-ink); }
.form-msg.ok { color: var(--offer); }

.auth-submit { width: 100%; margin-top: 20px; }

.hidden-fields {
  display: none;
}

.pw-hints {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--ink-soft);
  display: none;
}

.pw-hints li {
  padding-left: 18px;
  position: relative;
  line-height: 1.6;
}

.pw-hints li::before {
  content: "○";
  position: absolute;
  left: 0;
  color: var(--line);
}

.pw-hints li.met {
  color: var(--offer);
}

.pw-hints li.met::before {
  content: "●";
  color: var(--offer);
}

.link-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  color: var(--ink);
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }

/* ---------- App (app.html) ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- App tabs ---------- */
.app-hero {
  text-align: center;
  padding-top: 8px;
}

.app-hero .hero-figure--sm {
  transform: scale(0.3);
  transform-origin: top center;
  margin-bottom: -335px;
  margin-top: -20px;
}

.app-hero-text {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 4px;
}

.app-primary-action {
  margin: 28px 0 12px;
}

.app-primary-btn {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 999px;
}

.app-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
}

.app-tab {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

.app-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filters select {
  width: auto;
  min-width: 0;
  font-size: 13px;
  padding: 8px 10px;
}

.filters .btn-sm {
  flex-shrink: 0;
}

.listing-row--static {
  cursor: default;
}

/* ---------- Listings table ---------- */
.listings-grid {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 48px;
  background: var(--paper-raised);
}

.listing-row {
  display: grid;
  grid-template-columns: 52px 84px 1.6fr 1fr 110px;
  gap: 14px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.listing-row:last-child {
  border-bottom: none;
}

.listing-row:not(.listing-row--head):hover {
  background: var(--paper);
}

.listing-row--head {
  cursor: default;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--paper);
}

.listing-row-photo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.listing-row-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-row-photo-placeholder {
  font-size: 16px;
  opacity: 0.35;
}

.listing-row-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.listing-row-title strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-row-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-row-org,
.listing-row-condition {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .listing-row {
    grid-template-columns: 40px 1fr;
    grid-template-areas:
      "photo title"
      "photo meta";
  }
  .listing-row-photo { grid-area: photo; width:40px; height:40px; }
  .listing-row-title { grid-area: title; }
  .listing-row.listing-row--head .listing-row-org,
  .listing-row.listing-row--head .listing-row-condition,
  .listing-row .tag { display: none; }
  .listing-row-org, .listing-row-condition {
    grid-area: meta;
    display: inline;
    font-size: 11px;
  }
  .listing-row--head { display: none; }
}

/* ---------- Post view ---------- */
.post-card {
  position: relative;
  max-width: 560px;
  margin: 0 auto 48px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

input[type="file"] {
  width: 100%;
  padding: 10px 0;
  font-size: 13px;
}

/* ---------- Detail modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 31, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  position: relative;
  background: var(--paper-raised);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}

.modal-photo {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 14px;
  max-height: 220px;
  object-fit: cover;
}

.modal-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 10px 0 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.modal-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13px;
  margin: 0 0 20px;
}

.modal-details dt {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  align-self: center;
}

.modal-details dd {
  margin: 0;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.listing-inquiry-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin: 10px 0 0;
}

#mark-given-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

#mark-given-form label {
  margin-top: 0;
}

.post-close {
  top: 16px;
  right: 16px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}

.type-toggle {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.type-toggle button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.type-toggle button.active[data-type="offer"] { background: var(--offer-tint); color: var(--offer); border-color: transparent; }
.type-toggle button.active[data-type="request"] { background: var(--request-tint); color: var(--request); border-color: transparent; }
