/* ----------------------------------------------------------------------------
   Webtailorings — premium dark portfolio
---------------------------------------------------------------------------- */

:root {
  --bg: #08080c;
  --bg-soft: #0d0d14;
  --surface: #111118;
  --surface-2: #161620;
  --border: #232333;
  --border-strong: #34344a;
  --text: #ecedf2;
  --text-dim: #b5b8c5;
  --muted: #7a7d8c;
  --accent: #ff7a59;
  --accent-2: #b06bff;
  --accent-3: #5b8cff;
  --danger: #ff6b6b;
  --success: #5dd39e;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(176, 107, 255, 0.25), 0 30px 80px -20px rgba(176, 107, 255, 0.35);

  --easing: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: rgba(255, 122, 89, 0.35); color: #fff; }

a { color: inherit; }
img, iframe { display: block; max-width: 100%; }

.muted { color: var(--muted); }
.error {
  color: var(--danger);
  margin: 0.6rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---------------- Background ---------------- */

.bg-aurora {
  position: fixed;
  inset: -20vh -20vw;
  z-index: -2;
  pointer-events: none;
  filter: blur(80px) saturate(140%);
  opacity: 0.55;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  will-change: transform;
}

.aurora.a1 {
  width: 55vw; height: 55vw;
  top: -10vh; left: -8vw;
  background: radial-gradient(circle at center, #b06bff 0%, transparent 60%);
  animation: drift 22s var(--easing) infinite alternate;
}
.aurora.a2 {
  width: 50vw; height: 50vw;
  top: 20vh; right: -12vw;
  background: radial-gradient(circle at center, #ff7a59 0%, transparent 60%);
  animation: drift 28s var(--easing) infinite alternate-reverse;
}
.aurora.a3 {
  width: 45vw; height: 45vw;
  bottom: -15vh; left: 25vw;
  background: radial-gradient(circle at center, #5b8cff 0%, transparent 60%);
  animation: drift 32s var(--easing) infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0)        scale(1); }
  50%  { transform: translate3d(4vw, 6vh, 0)    scale(1.08); }
  100% { transform: translate3d(-3vw, -4vh, 0)  scale(0.96); }
}

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------------- Top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 2rem;
  background: rgba(8, 8, 12, 0.55);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  color: var(--text);
}

.brand-mark {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: conic-gradient(from 0deg, #ff7a59, #b06bff, #5b8cff, #ff7a59);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 4px 14px rgba(176, 107, 255, 0.45);
  animation: spin 8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.brand-text {
  background: linear-gradient(90deg, #fff, #cfd1da);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s var(--easing), background 0.2s var(--easing);
}

.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }

@media (max-width: 640px) {
  .nav-link { display: none; }
  .topbar { padding: 0.85rem 1.1rem; }
}

/* ---------------- Buttons ---------------- */

.btn-primary, .btn-ghost {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.18s var(--easing), background 0.2s var(--easing),
              border-color 0.2s var(--easing), color 0.2s var(--easing),
              box-shadow 0.25s var(--easing);
  white-space: nowrap;
}

.btn-primary {
  color: #15080b;
  background: linear-gradient(135deg, #ffb199 0%, #ff7a59 50%, #b06bff 100%);
  background-size: 200% 200%;
  background-position: 0% 50%;
  box-shadow: 0 6px 22px -8px rgba(255, 122, 89, 0.55),
              inset 0 1px 0 rgba(255,255,255,0.4);
}

.btn-primary:hover {
  background-position: 100% 50%;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -8px rgba(176, 107, 255, 0.6),
              inset 0 1px 0 rgba(255,255,255,0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-arrow {
  transition: transform 0.25s var(--easing);
  display: inline-block;
}

.btn-primary:hover .btn-arrow { transform: translateX(3px); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.02);
}

/* ---------------- Layout ---------------- */

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

@media (max-width: 640px) {
  main { padding: 1.5rem 1.1rem 4rem; }
}

/* ---------------- Hero ---------------- */

.hero {
  padding: 4rem 0 5rem;
  max-width: 900px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(93, 211, 158, 0.08);
  border: 1px solid rgba(93, 211, 158, 0.2);
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(93, 211, 158, 0.7);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(93, 211, 158, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(93, 211, 158, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 211, 158, 0); }
}

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 1.5rem;
}

.hero-title em {
  font-family: "DM Serif Display", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ff5e7a 0%, #ff7a59 50%, #ffb199 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.08em;
}

.hero-sub {
  max-width: 560px;
  font-size: 1.1rem;
  color: var(--text-dim);
  margin: 0;
}

/* ---------------- Work section ---------------- */

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.section-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 5rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
}

.empty-state code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
  color: var(--text);
}

/* ---------------- Card ---------------- */

.card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  transition: transform 0.4s var(--easing),
              border-color 0.3s var(--easing),
              box-shadow 0.4s var(--easing);
  opacity: 0;
  animation: cardIn 0.7s var(--easing) forwards;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.18), rgba(176, 107, 255, 0.18) 50%, rgba(91, 140, 255, 0.18));
  opacity: 0;
  transition: opacity 0.4s var(--easing);
  mix-blend-mode: screen;
}

.card:hover::after { opacity: 0.9; }

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1a1a26, #0f0f17);
  overflow: hidden;
}

/* Iframe is rendered at a fixed virtual viewport, then scaled to fit the card.
   The exact scale is computed per-card in JS via --thumb-scale to always fit
   pixel-perfect at any column width. pointer-events:none so clicks reach the
   link. The card sets --hover-scale on hover for the subtle zoom-in. */
.card-thumb iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  transform: scale(calc(var(--thumb-scale, 0.25) * var(--hover-scale, 1)));
  transform-origin: 0 0;
  pointer-events: none;
  transition: transform 0.6s var(--easing);
  background: white;
}

.card { --hover-scale: 1; }
.card:hover { --hover-scale: 1.06; }

.card-thumb-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 100% 100%, rgba(176, 107, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(8,8,12,0) 55%, rgba(8,8,12,0.55) 100%);
  pointer-events: none;
  transition: opacity 0.4s var(--easing);
}

.card-cta {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: rgba(8, 8, 12, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s var(--easing), transform 0.3s var(--easing);
  pointer-events: none;
}

.card:hover .card-cta {
  opacity: 1;
  transform: translateY(0);
}

.card-body {
  padding: 1.05rem 1.2rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------------- Dialog ---------------- */

.dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  color: var(--text);
  padding: 2rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-md);
  font-family: inherit;
}

.dialog[open] {
  animation: dialogIn 0.35s var(--easing);
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.dialog::backdrop {
  background: rgba(8, 8, 12, 0.7);
  backdrop-filter: blur(8px);
  animation: backdropIn 0.3s var(--easing);
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dialog-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.15), rgba(176, 107, 255, 0.15));
  border: 1px solid rgba(176, 107, 255, 0.25);
  color: #fff;
  margin-bottom: 1rem;
}

.dialog h2 {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dialog p { margin: 0; }

.dialog input[type="password"] {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  letter-spacing: 0.05em;
  transition: border-color 0.2s var(--easing), box-shadow 0.2s var(--easing);
}

.dialog input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(176, 107, 255, 0.18);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* ---------------- Footer ---------------- */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  background: linear-gradient(180deg, transparent, rgba(176, 107, 255, 0.04));
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.footer-mail {
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  background: linear-gradient(90deg, #ff7a59, #b06bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--easing);
}

.footer-mail:hover { border-bottom-color: rgba(176, 107, 255, 0.5); }

.footer-meta { font-size: 0.85rem; }

@media (max-width: 640px) {
  .footer-inner { padding: 2rem 1.1rem; }
}
