/* CUDFIRM Portfolio page (portfolio.html).
   The cards, panels, filter pills and preview dialog come from css/ecosystem.css — the SAME rules as the
   homepage Portfolio tab (the page wraps its content in #tab4 on purpose). This file only adds what the
   standalone page needs around them: the top bar, search box, pagination, footer, and the phone layout.
   Brand tokens: forest, jade, gold, cream; Syne + DM Sans. Loaded without the app-shell css/styles.css. */
:root {
  --n-forest: #0B3D2E; --n-jade: #1A6B4A; --n-sage: #4D9E7A; --n-gold: #C8922A; --n-gold-light: #E8B84B; --n-gold-pale: #F5E6C4;
  --n-cream: #F5F0E6; --n-white: #FAFAF8; --n-charcoal: #1C2218; --n-body: #3A4035; --n-muted: #7A8A72; --n-border: #D4CEC4;
  --pf-bg: var(--n-cream); --pf-card: #fff; --pf-text: var(--n-body); --pf-border: #E8E4DC; --pf-head: var(--n-forest);
  --shadow-sm: 0 4px 8px -2px rgba(11,61,46,.10), 0 2px 4px -2px rgba(11,61,46,.06);
  --r-sm: 8px; --r-md: 14px;
}
[data-theme="dark"] {
  --pf-bg: #060E08; --pf-card: #0C1A0F; --pf-text: #D4EAD8; --pf-border: rgba(46,102,64,.45); --pf-head: #D4EAD8; --n-muted: #7FA882;
  --n-gold-pale: rgba(200,146,42,.14);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "DM Sans", system-ui, sans-serif; line-height: 1.6; color: var(--pf-text); background: var(--pf-bg); -webkit-font-smoothing: antialiased; transition: background-color .3s, color .3s; }
:focus-visible { outline: 3px solid var(--n-gold); outline-offset: 2px; border-radius: 4px; }
.pf-skip { position: absolute; left: -999px; top: 8px; background: var(--n-forest); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 300; }
.pf-skip:focus { left: 8px; }

/* Header (same gradient as the homepage header) */
.pf-header { position: sticky; top: 0; z-index: 100; background: linear-gradient(135deg, #0B3D2E 0%, #1A6B4A 55%, #0B3D2E 100%); box-shadow: 0 8px 20px rgba(0,0,0,.18); padding-top: env(safe-area-inset-top, 0px); }
[data-theme="dark"] .pf-header { background: linear-gradient(135deg, #060E08 0%, #0C1A0F 55%, #142B18 100%); }
.pf-header-in { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; max-width: 1200px; margin: 0 auto; }
.pf-brand { background: rgba(255,255,255,.12); padding: .2em .7em; border-radius: 6px; letter-spacing: .15em; color: #fff; text-decoration: none; font: 800 1rem "Syne", sans-serif; margin-right: auto; }
.pf-nav { display: none; gap: .25rem; align-items: center; }
.pf-nav a { color: #E9F1EC; text-decoration: none; padding: .4rem .75rem; border-radius: 999px; font-weight: 500; font-size: .85rem; }
.pf-nav a:hover { background: rgba(255,255,255,.12); }
.pf-nav a[aria-current="page"] { background: var(--n-gold-pale); color: var(--n-forest); font-weight: 700; }
.pf-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; cursor: pointer; display: inline-grid; place-items: center; }
.pf-icon-btn[hidden] { display: none; }
.pf-icon-btn:hover { background: rgba(255,255,255,.12); }
/* On phones and tablets the bottom bar (js/app-shell.js) is the navigation, as on the homepage; MENU stays for the extra pages. */
@media (min-width: 992px) { .pf-nav { display: flex; } .pf-menu { display: none; } .pf-brand { margin-right: 0; } .pf-nav { margin-right: auto; } }

/* Page */
.pf-main { max-width: 1200px; margin: 0 auto; padding: .8rem .5rem 2rem; }
.pf-h1 { margin: 0 0 .6rem .4rem; font-size: 1rem; }
.badge.text-bg-primary { background: var(--n-forest) !important; font-family: "Syne", sans-serif; letter-spacing: .08em; font-size: .7rem; padding: .35em .75em; }
[data-theme="dark"] .badge.text-bg-primary { background: #2E6640 !important; }
.pf-note { background: var(--n-gold-pale); border: 0; border-left: 4px solid var(--n-gold); border-radius: 8px; font-size: .83rem; color: var(--n-forest); padding: .7rem 1rem; margin: 0 0 .8rem; }
[data-theme="dark"] .pf-note { color: var(--pf-text); }
.pf-green { color: #1A6B4A; font-weight: 600; }
[data-theme="dark"] .pf-green { color: #4D9E7A; }
@media (min-width: 768px) { .pf-main { padding: 1rem .9rem 2.5rem; } }

/* Search (sits above the filter pills inside the "What We Build" panel) */
.pf-search { position: relative; margin-bottom: .7rem; }
.pf-search i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--n-muted); pointer-events: none; }
.pf-search input { width: 100%; min-height: 44px; border: 1.5px solid var(--eco-border, var(--n-border)); border-radius: 999px; background: transparent; color: var(--pf-text); padding: .6rem 1rem .6rem 2.4rem; font: 400 16px "DM Sans", sans-serif; min-width: 0; -webkit-appearance: none; appearance: none; }
.pf-search input:focus { border-color: var(--n-gold); outline: none; }
.pf-status { font-size: .8rem; color: var(--n-muted); min-height: 1.2em; margin: 0 0 .6rem; }

/* Same card grid as the tab: two across on phones, three on tablets, four on wide screens.
   On very narrow phones the cards scroll sideways in one row rather than stacking into a single column. */
#tab4 .pf-grid .pf-card { min-width: 0; }
@media (max-width: 339px) {
  #tab4 .pf-grid { display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 62%; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: .5rem; scrollbar-width: thin; }
  #tab4 .pf-grid .pf-card { scroll-snap-align: start; }
}

/* Loading placeholders: same proportions as a real card so nothing jumps when projects arrive */
.pf-skel-card { pointer-events: none; }
.pf-skel-card .pf-preview { background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.02) 37%, rgba(0,0,0,.06) 63%); background-size: 400% 100%; animation: pfsh 1.4s ease infinite; }
.pf-skel-card .pf-meta i { display: block; height: 10px; border-radius: 6px; background: rgba(0,0,0,.07); }
.pf-skel-card .pf-meta i:first-child { width: 75%; } .pf-skel-card .pf-meta i:last-child { width: 40%; }
@keyframes pfsh { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
[data-theme="dark"] .pf-skel-card .pf-preview { background: linear-gradient(90deg, #14211a 25%, #1b2b21 37%, #14211a 63%); background-size: 400% 100%; }
[data-theme="dark"] .pf-skel-card .pf-meta i { background: #1b2b21; }
@media (prefers-reduced-motion: reduce) { .pf-skel-card .pf-preview { animation: none; } html { scroll-behavior: auto; } }

/* Preview dialog extras (mobile screenshot, shown only when a project has one) */
.pf-modal-mobile { display: grid; gap: 6px; justify-items: start; }
.pf-modal-mobile img { width: auto; max-width: 100%; max-height: 260px; border-radius: 14px; border: 1px solid var(--eco-border, var(--n-border)); background: #fff; }

/* Pager + empty state */
.pf-pager { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; align-items: center; margin: 1.2rem 0 .3rem; }
.pf-pager button { min-width: 44px; min-height: 44px; border: 1.5px solid var(--eco-border, var(--n-border)); background: transparent; border-radius: var(--r-sm); font: 600 .9rem "DM Sans", sans-serif; color: var(--pf-head); cursor: pointer; }
.pf-pager button[aria-current="page"] { background: var(--n-forest); border-color: var(--n-forest); color: #fff; }
[data-theme="dark"] .pf-pager button[aria-current="page"] { background: #2E6640; border-color: #2E6640; }
.pf-pager button:disabled { opacity: .4; cursor: default; }
#tab4 .pf-empty { text-align: center; padding: 1.6rem 1rem; border: 1px dashed var(--n-border); border-radius: var(--r-md); color: var(--n-muted); }
#tab4 .pf-empty h3 { font: 700 1.1rem "Syne", sans-serif; color: var(--pf-head); margin: 0 0 .3rem; }
#tab4 .pf-empty p { margin: 0; }
#tab4 .pf-empty .pf-clear { flex: none; margin-top: .8rem; padding: 0 1.3rem; }
.view-more-btn { display: block; width: 100%; padding: .75rem 1rem; background: rgba(11,61,46,.06); border: 1px dashed var(--n-border); border-radius: var(--r-sm); color: var(--n-jade); font: 600 .85rem "DM Sans", sans-serif; text-align: center; text-decoration: none; }
.view-more-btn:hover { background: rgba(11,61,46,.12); border-color: var(--n-jade); color: var(--n-forest); }
[data-theme="dark"] .view-more-btn { background: rgba(46,102,64,.1); border-color: rgba(46,102,64,.4); color: #7fc3a2; }
body.pf-lock { overflow: hidden; }

/* Footer */
.pf-footer { background: linear-gradient(135deg, #0B3D2E, #1A6B4A 55%, #0B3D2E); color: #CFE0D6; font-size: .85rem; padding: 1.1rem .9rem 1.1rem; }
[data-theme="dark"] .pf-footer { background: linear-gradient(135deg, #060E08, #0C1A0F 55%, #142B18); }
.pf-footer-in { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; justify-content: space-between; align-items: center; }
.pf-footer nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.pf-footer a { color: #fff; text-decoration: none; }
.pf-footer a:hover { text-decoration: underline; }
@media (min-width: 992px) { .pf-footer { padding-bottom: 1.1rem; } }
