/* The public portal ({slug}.list79.com or /p/{slug}): our customers' page, so a neutral look that sits
   next to any product, in their colour (PortalTheme sets --p-brand), not List79's own style.
   Everything reads the variables below: light and dark, rounded and square, brand colour or not. */

:root {
  --p-page: #fafafa;
  --p-surface: #ffffff;
  --p-subtle: #f4f4f5;
  --p-ink: #18181b;
  --p-ink-2: #3f3f46;
  --p-ink-3: #71717a;
  --p-border: #e4e4e7;
  --p-border-strong: #d4d4d8;
  --p-accent: var(--p-brand, #18181b);
  --p-on-accent: var(--p-on-brand, #ffffff);
  --p-link: var(--p-link-light, #18181b);
  --p-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
  --p-radius: 12px;
  --p-radius-sm: 8px;
  --p-pill: 999px;
  --p-font: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", "Noto Sans", sans-serif;

  /* Stage and status colours keep their meaning whatever the brand colour. */
  --rm-planned: #a1a1aa;
  --rm-progress: #d97706;
  --rm-progress-soft: #fef3c7;
  --rm-progress-ink: #92400e;
  --rm-shipped: #16a34a;
  --rm-shipped-soft: #dcfce7;
  --rm-shipped-ink: #166534;
  --s-planned: #dbeafe; --s-planned-ink: #1e40af;
  --s-declined: #fee2e2; --s-declined-ink: #991b1b;
  color-scheme: light;
}

html[data-corners="square"] { --p-radius: 3px; --p-radius-sm: 2px; --p-pill: 3px; }

html[data-appearance="dark"] {
  --p-page: #18181b; --p-surface: #222226; --p-subtle: #2a2a2f;
  --p-ink: #f4f4f5; --p-ink-2: #d4d4d8; --p-ink-3: #a1a1aa;
  --p-border: #34343a; --p-border-strong: #45454d;
  --p-accent: var(--p-brand, #f4f4f5); --p-on-accent: var(--p-on-brand, #18181b); --p-link: var(--p-link-dark, #f4f4f5);
  --p-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --rm-planned: #71717a; --rm-progress: #f59e0b; --rm-progress-soft: rgba(245, 158, 11, .14); --rm-progress-ink: #fcd34d;
  --rm-shipped: #22c55e; --rm-shipped-soft: rgba(34, 197, 94, .14); --rm-shipped-ink: #86efac;
  --s-planned: rgba(59, 130, 246, .18); --s-planned-ink: #bfdbfe;
  --s-declined: rgba(239, 68, 68, .18); --s-declined-ink: #fecaca;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-appearance="auto"] {
    --p-page: #18181b; --p-surface: #222226; --p-subtle: #2a2a2f;
    --p-ink: #f4f4f5; --p-ink-2: #d4d4d8; --p-ink-3: #a1a1aa;
    --p-border: #34343a; --p-border-strong: #45454d;
    --p-accent: var(--p-brand, #f4f4f5); --p-on-accent: var(--p-on-brand, #18181b); --p-link: var(--p-link-dark, #f4f4f5);
    --p-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --rm-planned: #71717a; --rm-progress: #f59e0b; --rm-progress-soft: rgba(245, 158, 11, .14); --rm-progress-ink: #fcd34d;
    --rm-shipped: #22c55e; --rm-shipped-soft: rgba(34, 197, 94, .14); --rm-shipped-ink: #86efac;
    --s-planned: rgba(59, 130, 246, .18); --s-planned-ink: #bfdbfe;
    --s-declined: rgba(239, 68, 68, .18); --s-declined-ink: #fecaca;
    color-scheme: dark;
  }
}

/* Base */
html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }
body.portal {
  --bs-body-font-family: var(--p-font);
  --bs-body-color: var(--p-ink);
  --bs-body-bg: var(--p-page);
  --bs-border-color: var(--p-border);
  --bs-secondary-color: var(--p-ink-3);
  font-family: var(--p-font); background: var(--p-page); color: var(--p-ink);
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
.portal h1, .portal h2, .portal h3 { font-family: var(--p-font); font-weight: 700; letter-spacing: -0.015em; color: var(--p-ink); }
.portal a { color: var(--p-link); text-underline-offset: 2px; }
.portal a:hover { color: var(--p-ink); }
.portal-main { flex: 1; max-width: 1040px; padding-top: 32px; padding-bottom: 48px; }

/* Buttons and fields */
.portal .btn {
  font-family: var(--p-font); font-weight: 600; border-radius: var(--p-radius-sm); box-shadow: none;
  border: 1px solid var(--p-border-strong); transition: background-color .12s, border-color .12s, filter .12s;
}
.portal .btn-primary { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); }
.portal .btn-primary:hover, .portal .btn-primary:focus { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); filter: brightness(.92); }
.portal .btn-light { background: var(--p-surface); color: var(--p-ink); }
.portal .btn-light:hover { background: var(--p-subtle); color: var(--p-ink); border-color: var(--p-border-strong); }
.portal .btn-link { border: none; color: var(--p-link); padding-left: 0; padding-right: 0; }
.portal .btn:focus-visible, .portal .form-control:focus, .portal .form-select:focus {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-accent) 28%, transparent); border-color: var(--p-accent);
}
.portal .form-control, .portal .form-select {
  background-color: var(--p-surface); color: var(--p-ink); border: 1px solid var(--p-border-strong); border-radius: var(--p-radius-sm);
}
.portal .form-control::placeholder { color: var(--p-ink-3); }
.portal .form-label { font-weight: 600; color: var(--p-ink-2); }
.form-hint { color: var(--p-ink-3); font-size: 13px; margin: 4px 2px 10px; }
.portal .text-danger { color: var(--s-declined-ink) !important; }

/* Header and footer */
.portal-head { background: var(--p-surface); border-bottom: 1px solid var(--p-border); }
.portal-head-inner { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.portal-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--p-ink) !important; text-decoration: none; }
.portal-brand img { width: 30px; height: 30px; border-radius: var(--p-radius-sm); object-fit: cover; }
.portal-nav { display: flex; gap: 18px; flex: 1; }
.portal-nav a { color: var(--p-ink-3); text-decoration: none; font-weight: 500; padding: 18px 0 16px; border-bottom: 2px solid transparent; }
.portal-nav a:hover { color: var(--p-ink); }
.portal-nav a[aria-current="page"] { color: var(--p-ink); border-bottom-color: var(--p-accent); }
.portal-account { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.portal-account form { margin: 0; }
.portal-foot { color: var(--p-ink-3); font-size: 13px; padding: 20px 0 28px; text-align: center; border-top: 1px solid var(--p-border); }
.portal-foot a { color: var(--p-ink-3); }
.portal-languages { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 8px; }
.portal-languages a { text-decoration: none; }
.portal-languages a[aria-current] { color: var(--p-ink); font-weight: 600; }
.portal-test-banner { background: #b45309; color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }

/* Shared bits */
.app-muted { color: var(--p-ink-3); font-size: 14px; }
.app-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.app-crumb { margin: 0 0 8px; font-size: 14px; }
.app-crumb a { color: var(--p-ink-3); text-decoration: none; }
.app-crumb a:hover { color: var(--p-ink); }
.app-card { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); padding: 18px 20px; margin-bottom: 16px; }
.app-card-title { font-size: 16px; margin-bottom: 10px; }
.app-badge { display: inline-block; padding: 1px 9px; border-radius: var(--p-pill); background: var(--p-subtle); font-size: 12px; font-weight: 600; color: var(--p-ink-2); white-space: nowrap; }
.app-status-planned { background: var(--s-planned); color: var(--s-planned-ink); }
.app-status-inprogress { background: var(--rm-progress-soft); color: var(--rm-progress-ink); }
.app-status-shipped { background: var(--rm-shipped-soft); color: var(--rm-shipped-ink); }
.app-status-declined { background: var(--s-declined); color: var(--s-declined-ink); }
.app-status-merged { background: var(--p-subtle); color: var(--p-ink-3); }
.app-entry { padding: 12px 0; border-top: 1px solid var(--p-border); }
.app-entry:first-of-type { border-top: none; padding-top: 0; }
.app-entry-meta { font-size: 13px; color: var(--p-ink-3); margin-bottom: 4px; }
.app-empty { text-align: center; padding: 44px 24px; background: var(--p-surface); border: 1px dashed var(--p-border-strong); border-radius: var(--p-radius); }
.app-empty h2 { font-size: 18px; margin: 12px 0 6px; }
.app-empty p { color: var(--p-ink-3); max-width: 420px; margin: 0 auto; }
.portal-empty-icon { width: 44px; height: 44px; color: var(--p-accent); opacity: .85; }

/* Sign-in card */
.auth-card { max-width: 420px; margin: 24px auto 48px; padding: 28px 26px 24px; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); }
.auth-card h1 { font-size: 24px; margin: 0 0 4px; }
.auth-lead { color: var(--p-ink-3); margin-bottom: 20px; }
.auth-links { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; font-size: 14px; color: var(--p-ink-3); }

/* Board */
.portal-intro { margin-bottom: 20px; }
.portal-intro h1 { font-size: 28px; margin-bottom: 6px; }
.portal-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.portal-tabs { display: flex; gap: 2px; padding: 3px; background: var(--p-subtle); border-radius: calc(var(--p-radius-sm) + 3px); }
.portal-tabs a { padding: 5px 12px; border-radius: var(--p-radius-sm); color: var(--p-ink-3); text-decoration: none; font-weight: 500; font-size: 14px; }
.portal-tabs a:hover { color: var(--p-ink); }
.portal-tabs a[aria-current="page"] { background: var(--p-surface); color: var(--p-ink); box-shadow: var(--p-shadow); }
.portal-search { flex: 1; min-width: 180px; }
.portal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.portal-list-single { margin-bottom: 6px; }
.portal-item { display: flex; gap: 14px; align-items: flex-start; background: var(--p-surface); padding: 14px 16px; border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); }
.portal-item form { margin: 0; }
.portal-vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 56px; flex: none;
  border: 1px solid var(--p-border-strong); border-radius: var(--p-radius-sm); background: var(--p-surface); color: var(--p-ink);
  text-decoration: none; font-size: 11px; line-height: 1.1; padding: 0;
}
.portal-vote strong { font-size: 18px; font-weight: 700; }
.portal-vote:hover { border-color: var(--p-accent); color: var(--p-ink); }
.portal-vote.on { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); }
.portal-item-text { min-width: 0; flex: 1; }
.portal-item-title { font-weight: 600; font-size: 16px; color: var(--p-ink) !important; text-decoration: none; margin-right: 6px; overflow-wrap: anywhere; }
.portal-item-title:hover { text-decoration: underline; }
.portal-item-body { margin: 4px 0 0; color: var(--p-ink-3); font-size: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.portal-item-meta { display: inline-block; margin-top: 4px; font-size: 13px; }
.portal-reason { background: var(--p-subtle); }
.portal-team { color: var(--p-link); }
.portal-new { max-width: 560px; }
.portal-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Product showcase on the board */
.portal-about { display: grid; gap: 20px; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--p-border); }
.portal-about-text { max-width: 760px; }
.portal-tagline { font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.portal-shots { list-style: none; padding: 0 0 8px; margin: 0; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; }
.portal-shots li { flex: 0 0 auto; scroll-snap-align: start; max-width: min(520px, 85vw); }
.portal-shots figure { margin: 0; }
.portal-shots img { display: block; height: 260px; width: auto; max-width: 100%; object-fit: contain; border-radius: var(--p-radius); border: 1px solid var(--p-border); background: var(--p-surface); }
.portal-shots figcaption { font-size: 14px; color: var(--p-ink-3); margin-top: 6px; }
.portal-about-milestones h2 { font-size: 17px; margin-bottom: 10px; }
.portal-more { font-size: 14px; font-weight: 500; margin-left: 10px; }

/* Roadmap: one track from idea to release. Planned is a dashed ring, in progress a pulsing amber
   dot, shipped a green check; a line joins the stages so the page reads as moving forward. */
.roadmap-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.roadmap-stage { min-width: 0; }
.roadmap-stage-head { display: flex; align-items: center; gap: 10px; position: relative; margin-bottom: 14px; }
.roadmap-stage-head h2 { font-size: 17px; margin: 0; background: var(--p-page); padding-right: 8px; } /* covers the line behind it */
.roadmap-count { font-size: 12px; font-weight: 700; color: var(--p-ink-3); background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-pill); padding: 0 8px; }
.roadmap-stage:not(:last-child) .roadmap-stage-head::after {
  content: ""; position: absolute; left: 28px; right: -20px; top: 50%; height: 2px; z-index: -1;
  background: repeating-linear-gradient(90deg, var(--p-border-strong) 0 7px, transparent 7px 13px);
}
.roadmap-stage.is-progress .roadmap-stage-head::after { background: linear-gradient(90deg, var(--rm-progress), var(--rm-shipped)); }
.roadmap-node { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; position: relative; display: inline-block; }
.is-planned .roadmap-node { border: 2px dashed var(--rm-planned); background: var(--p-page); }
.is-progress .roadmap-node { background: var(--rm-progress); box-shadow: 0 0 0 4px var(--rm-progress-soft); }
.is-progress .roadmap-node::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--rm-progress); animation: rm-pulse 2s ease-out infinite; }
.is-shipped .roadmap-node { background: var(--rm-shipped); }
.is-shipped .roadmap-node::before { content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
@keyframes rm-pulse { from { transform: scale(.8); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .is-progress .roadmap-node::after { animation: none; opacity: 0; } }
.roadmap-milestones { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.roadmap-period { font-size: 12px; font-weight: 700; color: var(--rm-shipped-ink); letter-spacing: .02em; margin: 6px 0 -2px; }
.roadmap-period:first-child { margin-top: 0; }
.roadmap-sub { font-size: 13px; font-weight: 600; color: var(--p-ink-3); margin: 4px 0 8px; }
.roadmap-empty { margin: 0 0 12px; }
.roadmap-stage .portal-item { padding: 12px; gap: 10px; }
.roadmap-stage .portal-vote { width: 44px; height: 48px; }

.portal-milestone { list-style: none; background: var(--p-surface); border: 1px solid var(--p-border); border-left: 4px solid var(--rm-planned); border-radius: var(--p-radius); box-shadow: var(--p-shadow); padding: 12px 14px; }
.portal-milestone.is-planned { border-left-style: dashed; }
.portal-milestone.is-progress { border-left-color: var(--rm-progress); background: linear-gradient(90deg, var(--rm-progress-soft), var(--p-surface) 60%); }
.portal-milestone.is-shipped { border-left-color: var(--rm-shipped); }
.portal-milestone h3 { font-size: 15px; line-height: 1.45; margin: 0; overflow-wrap: anywhere; text-wrap: pretty; }
/* Japanese breaks between phrases, not mid-word (Chrome and Edge; others fall back to normal). */
:lang(ja) .portal-milestone h3, :lang(ja) .milestone-strip-title { word-break: auto-phrase; overflow-wrap: normal; }
.portal-milestone-when { font-size: 12px; font-weight: 600; margin: 4px 0 0; color: var(--p-ink-3); }
.portal-milestone.is-progress .portal-milestone-when { color: var(--rm-progress-ink); }
.portal-milestone-text { font-size: 14px; color: var(--p-ink-2); margin: 6px 0 0; }
.portal-milestone-requests { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }

/* Front page: one compact card. */
.milestone-strip { list-style: none; margin: 0; padding: 2px 14px; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); max-width: 760px; }
.milestone-strip li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.milestone-strip li + li { border-top: 1px solid var(--p-border); }
.milestone-strip .roadmap-node { width: 14px; height: 14px; }
.milestone-strip .is-shipped .roadmap-node::before { left: 4px; top: 1.5px; width: 4px; height: 8px; }
.milestone-strip-title { flex: 1 1 auto; min-width: 0; font-weight: 600; line-height: 1.4; font-size: 15px; }
.milestone-strip-label { font-size: 12px; font-weight: 700; color: var(--rm-shipped-ink); margin-right: 6px; white-space: nowrap; }
.milestone-strip-when { flex: 0 0 auto; font-size: 13px; color: var(--p-ink-3); white-space: nowrap; }
.milestone-strip .is-progress .milestone-strip-when { color: var(--rm-progress-ink); font-weight: 600; }

@media (max-width: 860px) {
  .roadmap-track { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .roadmap-stage { position: relative; padding-left: 30px; padding-bottom: 12px; }
  .roadmap-stage-head { margin-left: -30px; }
  .roadmap-stage:not(:last-child) .roadmap-stage-head::after { display: none; }
  .roadmap-stage:not(:last-child)::before {
    content: ""; position: absolute; left: 8px; top: 22px; bottom: -8px; width: 2px;
    background: repeating-linear-gradient(180deg, var(--p-border-strong) 0 7px, transparent 7px 13px);
  }
  .roadmap-stage.is-progress:not(:last-child)::before { background: linear-gradient(180deg, var(--rm-progress), var(--rm-shipped)); }
}
@media (max-width: 576px) {
  .portal-intro h1 { font-size: 23px; }
  .portal-head-inner { gap: 0 18px; padding-top: 8px; }
  .portal-nav { order: 3; flex-basis: 100%; }
  .portal-nav a { padding: 10px 0; }
  .portal-account { margin-left: auto; }
  .portal-shots img { height: 200px; }
  .portal-milestone h3 { font-size: 15px; }
  .milestone-strip li { flex-wrap: wrap; gap: 4px 10px; padding: 9px 0; }
  .milestone-strip-title { flex-basis: calc(100% - 26px); }
  .milestone-strip-when { margin-left: 24px; font-size: 12px; }
  .milestone-strip li:nth-child(3):not(.is-shipped) { display: none; } /* two coming items and the latest release */
}
