/* ══════════════════════════════════════════════════════
   COMPONENTS — All shared UI patterns
   Depends on: tokens.css, base.css
   
   Sections:
     1. Nav
     2. Footer
     3. Buttons (portfolio primary/secondary)
     4. DS Buttons (design system button component)
     5. Section labels & headings (portfolio pages)
     6. Hero tag
     7. Tokens display (code blocks)
     8. Rules grid (usage rule cards)
══════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════
   1. NAV
══════════════════════════════════════════════════════ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 48px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  text-decoration: none;
  margin-right: auto;
}

.nav-sep {
  color: var(--text-tertiary);
  font-size: 11px;
  margin: 0 3px;
  user-select: none;
}

/* Portfolio nav (horizontal links) */
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-link:hover  { color: var(--text-primary); }
.nav-link.active { color: var(--text-primary); font-weight: 600; }

/* DS nav (breadcrumb item) */
.nav-item {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-item:hover  { color: var(--text-primary); }
.nav-item.active { color: var(--text-primary); }

/* Version badge (DS pages) */
.nav-badge {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-faint);
  border: 1px solid var(--accent-border);
  border-radius: 100px;
  padding: 3px 10px;
}

/* Portfolio nav CTA pill */
.nav-cta {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-inverse);
  background: var(--c-black);
  border-radius: 9999px;
  padding: 8px 20px;
  text-decoration: none;
  transition: background 0.18s;
  margin-left: 8px;
}
.nav-cta:hover { background: var(--c-taupe); }

@media (max-width: 900px)  { .nav-inner { padding: 0 24px; } }
@media (max-width: 640px)  { .nav-inner { padding: 0 16px; } .nav-links { display: none; } }

/* ══════════════════════════════════════════════════════
   2. FOOTER
══════════════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
}

.footer {
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* DS page footer (uses .footer inside .container) */
.footer-inner {
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-left {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-tertiary);
  letter-spacing: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-link {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--text-primary); }

/* ══════════════════════════════════════════════════════
   3. PORTFOLIO BUTTONS (index.html)
══════════════════════════════════════════════════════ */
.btn-primary {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-inverse);
  background: var(--c-black);
  border-radius: 9999px;
  padding: 14px 32px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover  { background: var(--c-taupe); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.975); }

.btn-secondary {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  background: transparent;
  border-radius: 9999px;
  padding: 14px 32px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  box-shadow: inset 0 0 0 2px var(--c-black);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { background: var(--c-black); color: var(--text-inverse); }

/* ══════════════════════════════════════════════════════
   4. DS BUTTON COMPONENT (buttons.html)
══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--btn-font);
  font-weight: var(--btn-weight);
  font-size: var(--btn-size);
  letter-spacing: var(--btn-ls);
  text-transform: var(--btn-transform);
  line-height: 1.4;
  border-radius: var(--btn-radius);
  border: none;
  outline: none;
  cursor: pointer;
  padding: var(--btn-pad-v) var(--btn-pad-h);
  transition: var(--btn-transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.btn:focus-visible { box-shadow: var(--btn-focus-ring); }

/* Size variants */
.btn-sm { padding: var(--btn-pad-v-sm) var(--btn-pad-h-sm); font-size: var(--btn-size-sm); }
.btn-md { padding: var(--btn-pad-v)    var(--btn-pad-h);    font-size: var(--btn-size-md); }
.btn-lg { padding: var(--btn-pad-v-lg) var(--btn-pad-h-lg); font-size: var(--btn-size-lg); }
.btn-xl { padding: var(--btn-pad-v-xl) var(--btn-pad-h-xl); font-size: var(--btn-size-xl); }

.btn-icon-only          { padding: 12px; aspect-ratio: 1; }
.btn-icon-only.btn-sm   { padding: 8px; }
.btn-icon-only.btn-lg   { padding: 16px; }

/* Solid variant */
.btn-solid { background: var(--btn-solid-bg); color: var(--btn-solid-text); box-shadow: none; }
.btn-solid:hover,  .btn-solid.state-hover   { background: var(--btn-solid-bg-hover); color: var(--btn-solid-text); }
.btn-solid:active, .btn-solid.state-active  { background: var(--btn-solid-bg-active); transform: scale(0.975); }
.btn-solid:focus-visible, .btn-solid.state-focus { background: var(--btn-solid-bg); box-shadow: var(--btn-focus-ring); }
.btn-solid:disabled, .btn-solid.state-disabled  { background: var(--btn-solid-bg-disabled); color: var(--btn-solid-text-disabled); cursor: not-allowed; pointer-events: none; }
.btn-solid.state-loading { color: transparent; pointer-events: none; }
.btn-solid.state-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.30); border-top-color: #FFFFFF; border-radius: 50%; animation: spin 0.65s linear infinite; }

/* Status badge — same outer dimensions as .btn-sm so it aligns with
   sibling buttons in an action row. Used for "NDA", "Deprecated",
   "In progress", "In design", and similar non-clickable status tags.
   Muted appearance via 50% opacity, no pointer affordance. */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--btn-font);
  font-weight: var(--btn-weight);
  font-size: var(--btn-size-sm);
  letter-spacing: var(--btn-ls);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-med);
  border-radius: var(--btn-radius);
  padding: var(--btn-pad-v-sm) var(--btn-pad-h-sm);   /* 8px 20px — matches .btn-sm */
  cursor: default;
  user-select: none;
  white-space: nowrap;
  opacity: 0.5;
}

/* Outline variant */
.btn-outline { background: transparent; color: var(--btn-outline-text); box-shadow: inset 0 0 0 2px var(--btn-outline-border); }
.btn-outline:hover,  .btn-outline.state-hover   { background: var(--btn-outline-bg-hover); color: var(--btn-outline-text-hover); box-shadow: inset 0 0 0 2px var(--btn-outline-border-hover); }
.btn-outline:active, .btn-outline.state-active  { background: rgba(0,0,0,0.82); color: #FFFFFF; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.82); transform: scale(0.975); }
.btn-outline:focus-visible, .btn-outline.state-focus { box-shadow: inset 0 0 0 2px var(--btn-outline-border), var(--btn-focus-ring); }
.btn-outline:disabled, .btn-outline.state-disabled  { box-shadow: inset 0 0 0 2px var(--btn-outline-border-disabled); color: var(--btn-outline-text-disabled); cursor: not-allowed; pointer-events: none; }
.btn-outline.state-loading { color: transparent; pointer-events: none; }
.btn-outline.state-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.18); border-top-color: #000000; border-radius: 50%; animation: spin 0.65s linear infinite; }

/* ══════════════════════════════════════════════════════
   5. SECTION LABELS & HEADINGS (portfolio pages)
══════════════════════════════════════════════════════ */
.section-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.section-subhead {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 620px;
  margin-bottom: 56px;
}

/* ══════════════════════════════════════════════════════
   6. HERO TAG (shared pill chip)
══════════════════════════════════════════════════════ */
.hero-tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--c-sand);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 5px 12px;
}
.hero-tag.hi,
.hero-tag.accent {
  color: var(--accent);
  background: var(--accent-faint);
  border-color: var(--accent-border);
}

/* ══════════════════════════════════════════════════════
   7. TOKENS DISPLAY (DS code blocks)
══════════════════════════════════════════════════════ */
.tokens-block {
  background: var(--surface-1);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.tokens-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-med);
  background: var(--c-white);
}

.tokens-filename {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tokens-filename::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.tokens-copy {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border-med);
  border-radius: 5px;
  padding: 4px 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}
.tokens-copy:hover { color: var(--text-primary); border-color: var(--border-strong); }

pre.tokens-pre {
  padding: 28px 28px 32px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-secondary);
}

/* Token syntax colouring */
.tc  { color: var(--text-tertiary); font-style: italic; }  /* comment  */
.tp  { color: var(--text-primary); }                       /* property */
.tv  { color: var(--accent); font-weight: 600; }           /* value    */
.tpu { color: var(--text-tertiary); }                      /* punctuation */

/* ══════════════════════════════════════════════════════
   8b. PREVIEW CARD
   ──────────────────────────────────────────────────────
   Component name: Preview Card
   Class prefix:   .preview-card

   A reusable app/project preview card based on the
   LoveTokens compact card. Used across the My Apps and
   Projects sections — anywhere a product needs an icon,
   title, description, optional preview image, optional
   stats, and an action row.

   Anatomy:
     • Icon (48×48) sits LEFT of the title + description
     • Optional preview image at top — FIXED 200px height,
       object-fit: cover (referenced against SkySavage's
       2.25:1 hero image — at the home card's ~410px
       width that ratio renders ~182px tall, so 200 is a
       clean round value that frames the same content)
     • Optional stats row inside the text column, aligned
       with title + description
     • Action row anchored to the card bottom

   Responsive:
     • width: 100%   — fills the parent grid cell
     • min-width: 340px — never collapses below that;
       paired with .app-grid's auto-fit + minmax(340px, 1fr)
       so the grid shows multiple columns when there's room
       and collapses to a single full-width column otherwise
══════════════════════════════════════════════════════ */

.preview-card {
  background: var(--c-white);
  border: none;
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  width: 100%;
  min-width: 340px;
}

/* Optional image area — fixed 230px height, image fills via object-fit */
.preview-card-image {
  width: 100%;
  height: 230px;
  overflow: hidden;
  flex-shrink: 0;
}
.preview-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Portrait modifier — for phone-screenshot-style images that would crop
   awkwardly with object-fit:cover. The image sits centered on a Sand
   surface and uses object-fit:contain to stay un-cropped. */
.preview-card-image.portrait {
  background: var(--c-sand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-card-image.portrait img {
  width: auto;
  height: 100%;
  max-width: 55%;
  object-fit: contain;
}

/* Landscape modifier — for wide 16:9 case-study previews. The container
   matches the image's aspect ratio so object-fit:cover produces zero
   cropping. Used in the Projects (Selected case studies) section. */
.preview-card-image.landscape {
  height: auto;
  aspect-ratio: 16 / 9;
}

/* Body — flex column. The 16px gap guarantees min spacing above the
   actions breakline; .preview-card-actions owns the bottom padding so
   the body's bottom inset is 0. */
.preview-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--sp-4);                  /* 16px min between header and actions */
  padding: var(--sp-5) var(--sp-6) 0; /* 20 24 0 — bottom handled by actions */
}

/* Header — icon left of title + description block */
.preview-card-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--sp-4);                  /* 16px */
  align-items: start;
}

.preview-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 0;                  /* PNG icons carry their own corners */
  overflow: hidden;
  flex-shrink: 0;
}
.preview-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Text column — title, description, optional metrics row */
.preview-card-text {
  display: flex;
  flex-direction: column;
}

.preview-card-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--h-weight);     /* 500 */
  letter-spacing: var(--ls-normal);
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.preview-card-desc {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: var(--p-weight);
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
}

/* Stats row — sits inside the text column, aligned with title + desc */
.preview-card-metrics {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}

/* Actions — right-aligned, anchored to bottom via margin-top:auto.
   The 1px top border acts as a breakline. Symmetric 16px padding on
   top and bottom keeps the buttons evenly framed by the line above
   and the card edge below. */
.preview-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-top: var(--sp-4);          /* 16px below the breakline */
  padding-bottom: var(--sp-4);       /* 16px above the card bottom */
  margin-top: auto;
  border-top: 1px solid var(--border);
}


/* ══════════════════════════════════════════════════════
   8c. BLOG PREVIEW CELL
   ──────────────────────────────────────────────────────
   Component name: Blog Preview Cell
   Class prefix:   .blog-preview-cell

   Used in the Blog section on index.html. Styled after the
   .ds-link-card pattern (white surface, rounded, taupe-on-
   hover) but sized for richer content — eyebrow label, post
   title in display type, an excerpt, and a meta line (date /
   reading time). Arrow on the right indicates a click target.
══════════════════════════════════════════════════════ */

/* Grid container — two cells side-by-side at desktop, stacked on mobile */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--sp-4);                    /* 16px */
}

.blog-preview-cell {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);                    /* 12px between blocks */
  padding: var(--sp-6);                /* 24px */
  background: var(--c-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.blog-preview-cell:hover {
  border-color: var(--border-strong);
  background: var(--c-sand);
}

/* Tag chips row — reuses .sidebar-tag styling */
.blog-preview-cell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);                    /* 4px */
}

/* Title + arrow on the same baseline */
.blog-preview-cell-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
}

.blog-preview-cell-title {
  font-family: var(--font-display);
  font-size: var(--fs-base);           /* 1rem — down from --fs-xl */
  font-weight: var(--h-weight);
  letter-spacing: var(--ls-normal);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

.blog-preview-cell-excerpt {
  font-family: var(--font-body);
  font-size: 0.8rem;                   /* down from --fs-sm */
  font-weight: var(--p-weight);
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
  /* Reserve the arrow column (18px svg + var(--sp-4) gap) so the
     excerpt's right edge matches the title's. */
  padding-right: calc(18px + var(--sp-4));
}

/* Generic blog meta line — used on the home page .blog-preview-cell
   and in the blog post hero (above the title). Small inline row of
   "Date · Reading time · Author" with bullet separators. */
.blog-cell-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);                    /* 8px */
  font-family: var(--font-body);
  font-size: 0.68rem;                  /* tightened from 0.7rem */
  font-weight: var(--p-weight);
  color: var(--text-tertiary);
}

.blog-preview-cell-arrow {
  flex-shrink: 0;
  color: var(--c-taupe);
  align-self: center;                  /* nudge SVG glyph to optical title center */
}


/* ══════════════════════════════════════════════════════
   8. RULES GRID (usage rule cards, all DS pages)
══════════════════════════════════════════════════════ */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.rule-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}

.rule-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent-faint);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}

.rule-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.rule-body {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.8;
}
.rule-body strong { color: var(--text-primary); font-weight: 600; }
.rule-body code   { font-family: var(--font-mono); font-size: 0.8em; background: var(--accent-faint); color: var(--accent); padding: 1px 5px; border-radius: 3px; }

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