/* Gateway page (/): the owner's workbench — the projects he built and what each one does.
   Concept: a data catalogue printed on squared paper. Every project is a table: the dark header
   carries its number, name and the way in; the body lists its features row by row, ruled into
   columns like a data dictionary; a feature that leads somewhere is marked like a foreign key.
   The numbered list beside the tables opens any project in one step, and its dashed line is the
   site's flowing data-path motif. Corners are square on purpose: these are sheets, not cards.
   Loaded after editorial.css and only on this page; colours and fonts come from its variables.
   Only fixed labels and numerals use the display subset font: project and feature names are
   free text typed in the admin, so they stay in the system sans. */

body.portal-page{background-image:radial-gradient(var(--line) 1px,transparent 1px);background-size:16px 16px}

.pt-nav{display:flex;align-items:center;justify-content:flex-end;gap:6px 24px;flex-wrap:wrap;font-family:var(--mono);font-size:12px;letter-spacing:.08em}
.pt-nav a{display:inline-flex;align-items:center;min-height:44px;transition:color .2s}
.pt-nav a:hover{color:var(--accent)}

/* Title band: what this page is, not who its owner is */
.pt-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px 56px;flex-wrap:wrap;padding:4px 0 24px;border-bottom:2px solid var(--text)}
.pt-eyebrow{display:flex;align-items:center;gap:10px;margin:0 0 16px;color:var(--accent)}
.pt-title{margin:0;font-family:var(--display);font-weight:900;font-size:clamp(72px,9vw,128px);line-height:.84;letter-spacing:-.05em}
.pt-legend{max-width:60em;margin:24px 0 0;font-size:15px;line-height:1.8;color:var(--muted);text-wrap:pretty}
/* Number keys are announced only where portal.js runs and a keyboard is likely. */
.pt-key{display:inline-grid;place-items:center;min-width:1.7em;height:1.7em;padding:0 .35em;border:1px solid currentColor;border-radius:2px;font:600 12px/1 var(--mono)}
.pt-keys-hint,.pt-enter .pt-key{display:none}
.portal-keys-on .pt-keys-hint{display:inline}
.portal-keys-on .pt-enter .pt-key{display:inline-grid}
.pt-keys-toggle{min-height:44px;margin-left:6px;padding:0 4px;border:0;background:none;font-family:var(--mono);font-size:12px;letter-spacing:.04em;color:var(--accent-deep);text-decoration:underline;text-underline-offset:4px}
.pt-keys-toggle:hover{color:var(--accent)}
@media (hover:none){
  .portal-keys-on .pt-keys-hint,.portal-keys-on .pt-enter .pt-key,.pt-keys-toggle{display:none}
}
.pt-stats{display:flex;gap:44px;margin:0}
.pt-stats div{display:flex;flex-direction:column;align-items:flex-end;gap:10px}
.pt-stats dt{color:var(--muted)}
.pt-stats dd{margin:0;font-family:var(--display);font-weight:900;font-size:clamp(40px,4.2vw,60px);line-height:.84;letter-spacing:-.04em;color:var(--accent-deep)}

/* The list that opens a project in one step: a pinned strip on narrow screens, a rail on wide ones.
   The layout is a plain block until the rail appears, so the strip can stay pinned down the page. */
.pt-layout{padding-top:20px}
.pt-index{position:sticky;top:0;z-index:15;min-width:0;margin:0 -6px 14px;padding-block:2px;background:var(--bg)}
.pt-index-title{display:none;margin:0 0 12px;color:var(--muted)}
/* The padding keeps focus rings inside the scrolling strip. */
.pt-index-list{display:flex;gap:8px;margin:0;padding:6px;list-style:none;overflow-x:auto;scrollbar-width:none}
.pt-index-list::-webkit-scrollbar{display:none}
.pt-index-list>li{position:relative;flex-shrink:0}
.pt-index-item{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 14px;border:1px solid var(--line-strong);background:var(--surface);font-size:15px;font-weight:700;line-height:1.3;transition:border-color .2s,color .2s}
.pt-index-no{color:var(--muted)}
.pt-index-arrow{color:var(--muted);transition:color .2s,transform .3s var(--ease)}
a.pt-index-item:hover{border-color:var(--accent);color:var(--accent-deep)}
a.pt-index-item:hover .pt-index-arrow{color:var(--accent);transform:translate(2px,-2px)}
.is-idle>.pt-index-item{border-style:dashed;background:transparent;color:var(--muted);font-weight:400}
.pt-index-state{color:var(--muted);text-transform:none;letter-spacing:.04em}

@media (max-width:1099px){
  /* Keeps a focused link clear of the pinned strip. */
  html{scroll-padding-top:84px}
}
@media (min-width:1100px){
  .pt-layout{display:grid;grid-template-columns:232px minmax(0,1fr);column-gap:48px;align-items:start;padding-top:36px}
  /* A list longer than the window scrolls on its own instead of running off the bottom. */
  .pt-index{top:28px;max-height:calc(100vh - 56px);margin:0;padding:0 8px 8px 0;overflow-y:auto;background:none}
  .pt-index-title{display:block}
  .pt-index-list{display:block;position:relative;padding:0 0 0 24px;overflow:visible}
  .pt-index-list::before{content:"";position:absolute;left:11px;top:22px;bottom:22px;width:1px;background:repeating-linear-gradient(to bottom,var(--accent) 0 4px,transparent 4px 9px);animation:pt-flow 1.2s linear infinite}
  .pt-index-list>li+li{margin-top:4px}
  .pt-index-list>li::before{content:"";position:absolute;left:-17px;top:22px;width:9px;height:9px;box-sizing:border-box;transform:translateY(-50%);border:2px solid var(--accent);background:var(--accent)}
  .pt-index-list>.is-idle::before{border-style:dashed;border-color:var(--dim);background:var(--bg)}
  .pt-index-item,.is-idle>.pt-index-item{padding:0 0 0 2px;border:0;background:none}
  .pt-index-arrow,.pt-index-state{margin-left:auto}
}
@keyframes pt-flow{to{background-position:0 9px}}

/* A project: a ruled sheet with a dark header */
.pt-tables{display:grid;gap:32px;min-width:0;padding-right:8px}
/* The entrance only slides: a sheet is readable from the first frame, even where animations never run. */
.pt-table{min-width:0;background:var(--surface);border:1px solid var(--accent-deep);box-shadow:8px 8px 0 var(--line);scroll-margin-top:84px;animation:pt-rise .6s var(--ease) both;animation-delay:calc(var(--i,0) * 70ms)}
@keyframes pt-rise{from{transform:translateY(16px)}}
.pt-table.is-idle{border-color:var(--muted);box-shadow:none}
.pt-table-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px 26px;align-items:center;padding:22px 28px;background:var(--accent-deep);color:var(--accent-ink)}
.pt-table.is-idle .pt-table-head{background:var(--muted)}
.pt-table-head :focus-visible{outline:2px solid var(--accent-ink);outline-offset:3px}
.pt-table-no{margin:0;font-family:var(--display);font-weight:900;font-size:64px;line-height:.9;letter-spacing:-.04em;color:rgba(255,255,255,.92)}
.pt-table-info{min-width:0}
.pt-table-name{margin:0;font-size:26px;font-weight:700;line-height:1.3;letter-spacing:-.01em;overflow-wrap:anywhere}
.pt-table-note{margin:6px 0 0;font-size:15px;line-height:1.65;color:rgba(255,255,255,.88);overflow-wrap:anywhere}
.pt-table-meta{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 0;text-transform:none;letter-spacing:.04em}
.pt-chip{display:inline-flex;align-items:center;min-height:26px;padding:0 10px;border:1px solid rgba(255,255,255,.5);overflow-wrap:anywhere}
.pt-chip.is-dim{border-style:dashed;color:rgba(255,255,255,.9)}
.pt-enter{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:48px;padding:0 22px;background:var(--surface);color:var(--accent-deep);font:700 16px/1.2 var(--sans);white-space:nowrap;transition:background .2s}
a.pt-enter:hover{background:var(--accent-soft)}
.pt-enter-arrow{font-family:var(--mono);font-size:18px;line-height:1;transition:transform .3s var(--ease)}
a.pt-enter:hover .pt-enter-arrow{transform:translate(2px,-2px)}
.pt-enter.is-off{border:1px dashed rgba(255,255,255,.55);background:none;color:rgba(255,255,255,.92);font-weight:400}

/* Fields: number | feature | what it does, ruled into columns */
.pt-fields-head,.pt-field{display:grid;grid-template-columns:72px minmax(160px,280px) minmax(0,1fr)}
.pt-fields-head>*,.pt-field>*{min-width:0;padding:4px 22px}
.pt-fields-head>*+*,.pt-field>*+*{border-left:1px solid var(--line)}
.pt-fields-head>:first-child,.pt-field>:first-child{padding-left:28px}
.pt-fields-head{border-bottom:1px solid var(--line-strong);background:var(--surface-2);color:var(--muted);font-size:11px}
.pt-fields-head>*{padding-block:9px 8px}
.pt-fields{margin:0;padding:0;list-style:none}
.pt-field{position:relative;border-bottom:1px solid var(--line);transition:background .2s}
.pt-field:last-child{border-bottom:0}
.pt-field:hover,.pt-field:focus-within{background:var(--bg)}
.pt-field-no{display:flex;align-items:center;color:var(--muted);letter-spacing:.06em}
.pt-field-key{display:flex;flex-wrap:wrap;align-items:center;gap:0 10px}
.pt-field-name{display:inline-flex;align-items:center;min-height:44px;font-size:16px;font-weight:700;line-height:1.4;overflow-wrap:anywhere}
a.pt-field-name{color:var(--accent-deep);text-decoration:underline;text-decoration-color:var(--line-strong);text-underline-offset:5px;transition:text-decoration-color .2s}
/* The whole row opens a linked feature; the ring stays inside the row. */
a.pt-field-name::after{content:"";position:absolute;inset:0}
a.pt-field-name:focus-visible{outline-offset:0}
.pt-field:hover a.pt-field-name{text-decoration-color:currentColor}
.pt-field-ref{padding:2px 8px;background:var(--accent-soft);color:var(--accent-deep);font-size:11px;letter-spacing:.04em;text-transform:none;overflow-wrap:anywhere}
.pt-field-note{display:flex;align-items:center;margin:0;font-size:15px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere}
.pt-fields-empty{margin:0;padding:16px 28px;font-size:14px;color:var(--muted)}

/* Owner only: a sheet that has not been filled in yet */
.pt-new{display:grid;justify-items:start;gap:2px;padding:14px 28px 18px;border:1px dashed var(--accent);background:var(--bg)}
.pt-new-link{display:inline-flex;align-items:center;min-height:44px;font-size:17px;font-weight:700;color:var(--accent-deep);text-decoration:underline;text-underline-offset:5px}
.pt-new-hint{margin:0;font-size:14px;color:var(--muted)}

.editorial .pt-footer{margin-top:72px;background:var(--bg)}

@media (max-width:979px){
  .pt-fields-head{display:none}
  .pt-field{grid-template-columns:56px minmax(0,1fr);padding-block:6px 10px}
  .pt-field>*{padding:0 18px}
  .pt-field>:first-child{padding-left:18px}
  .pt-field-no{grid-row:span 2;align-items:flex-start;padding-top:13px}
  .pt-field-key,.pt-field-note{grid-column:2}
  .pt-field-note:empty{display:none}
}
@media (max-width:760px){
  .pt-head{padding:0 0 20px}
  .pt-eyebrow{margin-bottom:12px}
  .pt-legend{margin-top:18px}
  .pt-stats{gap:28px}
  .pt-layout{padding-top:12px}
  .pt-tables{gap:24px;padding-right:6px}
  .pt-table{box-shadow:6px 6px 0 var(--line)}
  .pt-table-head{grid-template-columns:auto minmax(0,1fr);padding:18px}
  .pt-table-no{font-size:44px}
  .pt-table-name{font-size:22px}
  .pt-enter{grid-column:1 / -1;width:100%}
  .pt-fields-empty,.pt-new{padding-inline:18px}
}

/* Paper keeps the dark headers, which carry the project names in white. */
@media print{
  .pt-table{animation:none;box-shadow:none}
  .pt-table-head{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .pt-index{position:static;max-height:none}
}
