/* ============================================
   ASTERIS CREATIVE - PORTFOLIO ("/work") STYLES
   Shared design system for the portfolio listing
   and all case-study pages. Ported from the main
   site (public/index.html) so the look stays 1:1,
   plus portfolio-specific components.
   No build step. No dependencies. Local file only.
   ============================================ */

/* ============================================
   CUSTOM PROPERTIES
   ============================================ */
:root {
  --bg: #0A0A1E;
  --bg-surface: #141235;
  --bg-card: #1A1840;
  --accent: #22D3EE;
  --accent-dim: #8B5CF6;
  --accent-gradient: linear-gradient(135deg, #8B5CF6 0%, #D946EF 50%, #22D3EE 100%);
  --text-primary: #F5F3FF;
  --text-secondary: #9B98C9;
  --text-muted: #565478;
  --white: #F5F3FF;
  --border: #2A2850;
  --green: #5fb87a;
  --font-display: 'Syne', sans-serif;
  --font-serif: 'Instrument Serif', serif;
  --font-mono: 'DM Mono', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================
   GRAIN
   ============================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   NAV
   ============================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo { height: 34px; width: 34px; object-fit: contain; }
.nav-name span { color: var(--accent); }

.nav-links { display: flex; gap: 32px; list-style: none; align-items: center; }

.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active { color: var(--accent); }

.nav-cta-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 24px;
  background: var(--accent-gradient);
  color: var(--bg);
  border: none;
  transition: background 0.3s ease, transform 0.2s ease;
}

.nav-cta-btn:hover { background: var(--white); transform: translateY(-1px); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 24px; height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-gold {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 16px 36px;
  background: var(--accent-gradient);
  color: var(--bg);
  border: none;
  position: relative;
  overflow: hidden;
  transition: letter-spacing 0.4s var(--ease), background 0.3s ease;
  cursor: pointer;
}

.btn-gold:hover { letter-spacing: 0.08em; }

.btn-outline {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 28px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: none;
  transition: border-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================
   SECTION UTILITY
   ============================================ */
section { padding: 120px 40px; max-width: 1100px; margin: 0 auto; }

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--accent);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 48px;
}

.section-title .serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

/* ============================================
   PORTFOLIO HERO (listing page)
   ============================================ */
.portfolio-hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 160px 40px 80px;
  max-width: 1100px;
  margin: 0 auto;
}

.portfolio-hero .hero-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.portfolio-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 7vw, 78px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}

.portfolio-hero h1 .serif {
  color: var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.portfolio-hero p {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 560px;
}

/* ============================================
   WORK GRID + CARDS
   ============================================ */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.work-card {
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: background 0.4s var(--ease);
}

.work-card.linked { cursor: pointer; }
.work-card.linked:hover { background: var(--bg-card); }

.work-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

.work-card.linked:hover::after { transform: scaleX(1); }

.work-thumb {
  aspect-ratio: 16 / 10;
  width: 100%;
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.work-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.work-card.linked:hover .work-thumb img { transform: scale(1.04); }

/* Fallback gradient "thumbnail" when no image is set */
.work-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(139,92,246,0.14), transparent 55%),
    linear-gradient(135deg, #1A1840, #0F0D28);
}

.work-thumb.placeholder span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.03em;
  color: var(--text-muted);
  text-align: center;
  padding: 0 24px;
  line-height: 1.1;
}

.work-card-body { padding: 32px; display: flex; flex-direction: column; flex-grow: 1; }

.work-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.work-card-industry {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-real { color: var(--green); border-color: rgba(95,184,122,0.4); }
.badge-sample { color: var(--accent); border-color: var(--accent-dim); }
.badge-concept { color: var(--text-secondary); border-color: var(--border); }

.work-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.work-card .work-problem {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

.work-card .work-problem strong { color: var(--text-secondary); font-weight: 400; }

.work-card .work-solution {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 24px;
}

.work-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }

.work-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.work-card-cta {
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.work-card-cta .arrow { transition: transform 0.3s var(--ease); }
.work-card.linked:hover .work-card-cta .arrow { transform: translateX(5px); }

.work-card-cta.muted { color: var(--text-muted); }

/* ============================================
   CASE STUDY PAGE
   ============================================ */
.cs-hero {
  padding: 160px 40px 60px;
  max-width: 900px;
  margin: 0 auto;
}

.cs-breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.cs-breadcrumb a { color: var(--text-secondary); transition: color 0.3s ease; }
.cs-breadcrumb a:hover { color: var(--accent); }

.cs-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }

.cs-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.cs-hero h1 .serif {
  color: var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.cs-lede {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 680px;
  margin-bottom: 36px;
}

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  border: 1px solid var(--border);
  background: var(--border);
  margin-bottom: 8px;
}

.cs-meta-item { background: var(--bg-surface); padding: 20px 22px; }

.cs-meta-item .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cs-meta-item .v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.cs-meta-item .v a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }

/* Case-study body sections */
.cs-body { max-width: 900px; margin: 0 auto; padding: 40px 40px 40px; }

.cs-section { padding: 48px 0; border-top: 1px solid var(--border); }
.cs-section:first-child { border-top: none; }

.cs-section .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 14px;
}

.cs-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 3.5vw, 34px);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.cs-section h2 .serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.cs-section p {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text-secondary);
  margin-bottom: 18px;
  max-width: 720px;
}

.cs-section p strong { color: var(--text-primary); font-weight: 500; }

.cs-list { list-style: none; display: flex; flex-direction: column; gap: 14px; margin: 8px 0 18px; }

.cs-list li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-left: 26px;
  position: relative;
}

.cs-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 10px;
  width: 8px; height: 8px;
  background: var(--accent);
}

.cs-list li strong { color: var(--text-primary); font-weight: 500; }

/* Metrics grid (e.g. Lighthouse scores) */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  margin: 12px 0 8px;
}

.cs-metric { background: var(--bg-surface); padding: 28px 24px; text-align: center; }

.cs-metric .score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  color: var(--accent);
}

.cs-metric .score small { font-size: 16px; color: var(--text-muted); font-weight: 600; }

.cs-metric .cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 12px;
}

.cs-metric .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.cs-metrics-note { font-size: 12px; color: var(--text-muted); margin-top: 14px; }

/* Before / after table */
.cs-table { width: 100%; border-collapse: collapse; margin: 12px 0 8px; font-size: 13.5px; }

.cs-table th, .cs-table td {
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}

.cs-table thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-surface);
}

.cs-table tbody th {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  width: 18%;
  background: var(--bg-surface);
}

.cs-table .before { color: var(--text-muted); }
.cs-table .after { color: var(--text-secondary); }
.cs-table .after strong { color: var(--text-primary); font-weight: 500; }

/* Testimonial */
.cs-testimonial {
  background: var(--bg-surface);
  border-left: 2px solid var(--accent);
  padding: 36px 40px;
  margin: 12px 0;
}

.cs-testimonial blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.cs-testimonial cite {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* Screenshot / figure */
.cs-figure { margin: 16px 0; border: 1px solid var(--border); background: var(--bg-surface); }
.cs-figure img { width: 100%; }
.cs-figure figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* Tag row (services used) */
.cs-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cs-tags .work-tag { font-size: 11px; }

/* Honesty / note callout */
.cs-note {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 18px 22px;
  margin: 18px 0;
}

.cs-note strong { color: var(--text-secondary); }

/* ============================================
   CTA BLOCK (shared)
   ============================================ */
.cta-block {
  text-align: center;
  padding: 120px 40px;
  max-width: 700px;
  margin: 0 auto;
}

.cta-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.cta-title .serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.cta-text { font-size: 14px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 36px; }

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.footer a { color: var(--text-secondary); transition: color 0.3s ease; }
.footer a:hover { color: var(--accent); }

.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-logo { height: 26px; width: 26px; object-fit: contain; }

/* ============================================
   ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-cta-btn { display: none; }
  .hamburger { display: flex; }

  section { padding: 80px 24px; }
  .portfolio-hero { padding: 130px 24px 50px; }
  .cs-hero { padding: 120px 24px 40px; }
  .cs-body { padding: 24px; }
  .footer { padding: 32px 24px; flex-direction: column; gap: 12px; text-align: center; }

  .work-grid { grid-template-columns: 1fr; }
  .cs-meta { grid-template-columns: 1fr 1fr; }
  .cs-metrics { grid-template-columns: 1fr 1fr; }

  .cs-table, .cs-table thead, .cs-table tbody, .cs-table th, .cs-table td, .cs-table tr { display: block; }
  .cs-table thead { display: none; }
  .cs-table tbody th { width: auto; border-bottom: none; }
  .cs-table td { border-top: none; }
  .cs-table tr { margin-bottom: 16px; }
}

@media (max-width: 500px) {
  .cs-meta { grid-template-columns: 1fr; }
  .cs-metrics { grid-template-columns: 1fr; }
  .cs-testimonial { padding: 28px 24px; }
  .cs-testimonial blockquote { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
