/* ==========================================================
   Kuldeep Choudhary: portfolio styles
   Calm, warm, welcoming. Warm off-white + pitch-green accent.
   Sections: Tokens, Base, Header/Nav, Hero, Cards, Prose,
   Breadcrumbs, Next up, Links, Footer, Back to top, Motion
   ========================================================== */

/* ===== Tokens ===== */
:root {
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #ece6d8;
  --fg: #22251f;
  --muted: #5b5d53;
  --line: #e0d9c9;
  --accent: #1f5a3e;
  --accent-fg: #ffffff;
  --accent-soft: rgba(31, 90, 62, 0.09);
  --ph-bg: #fff6d6;
  --ph-line: #c9a227;
  --ph-fg: #5a4600;
  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Public Sans", "Segoe UI", Arial, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(50, 40, 20, 0.06), 0 2px 8px rgba(50, 40, 20, 0.05);
  --shadow-md: 0 8px 24px rgba(50, 40, 20, 0.11);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 0.25s;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121513; --surface: #1a1e1b; --surface-2: #232825; --fg: #ebede8;
    --muted: #a4aba6; --line: #2e3430; --accent: #6fcf9f; --accent-fg: #0f1a14;
    --accent-soft: rgba(111, 207, 159, 0.10);
    --ph-bg: #2a2410; --ph-line: #8a7220; --ph-fg: #e6cf7a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121513; --surface: #1a1e1b; --surface-2: #232825; --fg: #ebede8;
  --muted: #a4aba6; --line: #2e3430; --accent: #6fcf9f; --accent-fg: #0f1a14;
  --accent-soft: rgba(111, 207, 159, 0.10);
  --ph-bg: #2a2410; --ph-line: #8a7220; --ph-fg: #e6cf7a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.7;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}
::selection { background: var(--accent); color: var(--accent-fg); }
.wrap {
  width: 100%; max-width: 46rem; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--dur) ease; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ===== Header / Nav ===== */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--dur) ease, border-color var(--dur) ease, background-color var(--dur) ease;
}
@supports (background: color-mix(in srgb, red, blue)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: var(--shadow-sm); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 0.9rem; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.brand:hover { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.2rem; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 500; padding-block: 0.3rem;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0% 2px no-repeat;
  transition: color var(--dur) ease, background-size 0.3s var(--ease);
}
.nav a:hover { color: var(--fg); background-size: 100% 2px; }
.nav a[aria-current] { color: var(--fg); background-size: 100% 2px; }

.theme-btn {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0;
  color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background-color var(--dur) ease, border-color var(--dur) ease, transform var(--dur) var(--ease);
}
.theme-btn:hover { border-color: var(--accent); transform: rotate(-12deg); }
.theme-btn svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: block; }
}

main { padding-block: 1.5rem 4rem; }

/* ===== Hero (with a faint pitch centre-circle) ===== */
.hero { position: relative; padding-block: 1.25rem 2rem; }
.hero > * { position: relative; z-index: 1; }
.hero::before {
  content: ""; position: absolute; z-index: 0; right: -0.5rem; top: 50%;
  width: 7.5rem; height: 7.5rem; transform: translateY(-50%);
  background: var(--accent); opacity: 0.09; pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='black' stroke-width='2.5'%3E%3Ccircle cx='50' cy='50' r='34'/%3E%3Cpath d='M50 4v92M4 4h92v92H4z'/%3E%3Ccircle cx='50' cy='50' r='3' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='black' stroke-width='2.5'%3E%3Ccircle cx='50' cy='50' r='34'/%3E%3Cpath d='M50 4v92M4 4h92v92H4z'/%3E%3Ccircle cx='50' cy='50' r='3' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hero--home { padding-block: 3.25rem 3.25rem; }
.hero--home::before { width: min(12.5rem, 48vw); height: min(12.5rem, 48vw); }
.eyebrow { margin: 0 0 0.5rem; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 700; }
.hero--home h1 { font-size: clamp(2.7rem, 9vw, 4.4rem); letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; font-weight: 600; transition: color var(--dur) ease; }
.read-time {
  display: inline-block; margin: 0.9rem 0 0; padding: 0.15rem 0.8rem;
  font-size: 0.88rem; color: var(--muted); background: var(--surface-2); border-radius: var(--r-pill);
}
.muted { color: var(--muted); margin: 0.25rem 0 0; }

.block { padding-block: 1.75rem; border-top: 1px solid var(--line); }

/* ===== Cards ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.1rem; margin-top: 1rem; }
.cards.single { grid-template-columns: 1fr; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0;
  padding: 1.25rem 1.3rem 1.3rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  color: var(--fg); text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) ease, background-color var(--dur) ease;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.card:hover h3 { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; line-height: 1.5; }
.card-icon {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; margin-bottom: 0.45rem;
  font-size: 1.5rem; line-height: 1; background: var(--accent-soft); border-radius: 14px;
}
.card::after {
  content: "\2192"; position: absolute; right: 1.15rem; top: 1.2rem; color: var(--accent); font-weight: 600;
  opacity: 0; transform: translateX(-8px);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease);
}
.card:hover::after, .card:focus-visible::after { opacity: 1; transform: none; }
@media (hover: none) { .card::after { opacity: 0.6; transform: none; } }

/* ===== Prose ===== */
.prose { max-width: 65ch; }
.prose p { margin: 0 0 1.1rem; }
.hero + .prose > p:first-of-type { font-size: 1.22rem; line-height: 1.6; }
.pullquote {
  max-width: 34rem; margin: 2rem 0; padding: 1.2rem 1.5rem 1.2rem 1.6rem;
  border-left: 4px solid var(--accent); border-radius: 4px var(--r-md) var(--r-md) 4px;
  background: var(--accent-soft);
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.25rem, 3.6vw, 1.6rem); line-height: 1.3; text-wrap: balance;
}
.pullquote p { margin: 0; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem 1.5rem; margin: 1.5rem 0 0; }
.meta dt { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.meta dd { margin: 0.1rem 0 0; }

/* ===== Breadcrumbs ===== */
.crumbs { margin: 0 0 0.75rem; font-size: 0.92rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; margin: 0; padding: 0; list-style: none; color: var(--muted); }
.crumbs li + li::before { content: "\203A"; margin-right: 0.5rem; opacity: 0.7; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--fg); font-weight: 600; }

/* ===== Next up ===== */
.next-up { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.next-up .card { margin-top: 0.25rem; }

/* ===== Placeholders (kept loud on purpose, if you ever add any) ===== */
.ph { background: var(--ph-bg); color: var(--ph-fg); border: 1px dashed var(--ph-line); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0 0; font-size: 0.98rem; }
.ph-tag { display: block; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin-bottom: 0.2rem; }
.ph-inline { background: var(--ph-bg); color: var(--ph-fg); border: 1px dashed var(--ph-line); border-radius: 6px; padding: 0.05rem 0.5rem; font-size: 0.95rem; }

/* ===== Links page ===== */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.link-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem;
  padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), border-color var(--dur) ease, box-shadow var(--dur) var(--ease);
}
.link-list li:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.link-label { font-weight: 600; min-width: 14rem; }
.link-list a { overflow-wrap: anywhere; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); padding-block: 2rem; color: var(--muted); font-size: 0.92rem; }
.site-footer p { margin: 0; }
.site-footer .thanks { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--fg); margin-bottom: 0.25rem; }

/* ===== Back to top ===== */
.to-top {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem;
  color: var(--accent-fg); background: var(--accent); border-radius: var(--r-pill);
  text-decoration: none; font-size: 1.25rem; line-height: 1; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease), visibility 0s linear var(--dur);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.to-top:hover { transform: translateY(-3px); }

/* ===== Responsive ===== */
@media (max-width: 30rem) {
  .link-label { min-width: 0; width: 100%; }
  .hero::before { opacity: 0.07; right: 0; }
}

/* ===== Motion (gentle, and only if the visitor allows it) ===== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: no-preference) {
  /* Soft page-to-page fade (modern browsers; others just navigate normally) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out 0.15s ease both; }
  ::view-transition-new(root) { animation: vt-in 0.3s var(--ease) both; }
  .site-header { view-transition-name: site-header; }

  /* Entrance on load */
  .hero > * { animation: rise 0.6s var(--ease) both; }
  .hero > *:nth-child(2) { animation-delay: 0.08s; }
  .hero > *:nth-child(3) { animation-delay: 0.16s; }
  .crumbs { animation: rise 0.5s var(--ease) both; }
  .cards .card { animation: rise 0.6s var(--ease) both; }
  .cards .card:nth-child(1) { animation-delay: 0.15s; }
  .cards .card:nth-child(2) { animation-delay: 0.22s; }
  .cards .card:nth-child(3) { animation-delay: 0.29s; }
  .cards .card:nth-child(4) { animation-delay: 0.36s; }
  .cards .card:nth-child(5) { animation-delay: 0.43s; }
  .cards .card:nth-child(6) { animation-delay: 0.5s; }

  /* Reveal as sections scroll into view (pure CSS, where supported) */
  @supports (animation-timeline: view()) {
    .block, .pullquote, .next-up {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%;
    }
    .hero + .block { animation: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
