/* ==========================================================================
   Sandeep Patro — Portfolio
   Classic professional theme with light and dark modes.
   Change colors and fonts via the variables below.
   ========================================================================== */

:root {
  /* Colors (light) */
  --color-bg: #fff;
  --color-bg-alt: #f5f7fa;
  --color-surface: #fff;
  --color-text: #2b2f36;
  --color-heading: #1b2a41;
  --color-muted: #5f6b7a;
  --color-accent: #2f5d8a;
  --color-accent-dark: #234669;
  --color-on-accent: #fff;
  --color-border: #dde3ea;
  --color-header-bg: rgb(255 255 255 / 95%);
  --color-footer-bg: #1b2a41;
  --color-footer-text: #c9d3df;
  --shadow: 0 1px 3px rgb(27 42 65 / 8%), 0 4px 12px rgb(27 42 65 / 6%);
  --shadow-hover: 0 6px 20px rgb(27 42 65 / 12%);

  /* Typography */
  --font-heading: "Merriweather", georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", arial, sans-serif;

  /* Layout */
  --container-width: 1100px;
  --gutter: 1rem;
  --header-height: 64px;
  --radius: 6px;

  color-scheme: light;
}

/* Dark theme: set on <html> by the inline script in index.html and by the toggle */
:root[data-theme="dark"] {
  --color-bg: #0f1620;
  --color-bg-alt: #151e2a;
  --color-surface: #1a2533;
  --color-text: #d6dde6;
  --color-heading: #eef2f7;
  --color-muted: #9aa7b6;
  --color-accent: #7fb0e0;
  --color-accent-dark: #a3c7ec;
  --color-on-accent: #0f1620;
  --color-border: #2a3645;
  --color-header-bg: rgb(15 22 32 / 92%);
  --color-footer-bg: #0a1018;
  --color-footer-text: #9aa7b6;
  --shadow: 0 1px 3px rgb(0 0 0 / 30%), 0 4px 12px rgb(0 0 0 / 25%);
  --shadow-hover: 0 6px 20px rgb(0 0 0 / 40%);

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%; /* stylelint-disable-line property-no-vendor-prefix -- iOS Safari only supports the prefixed form */
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.25s, color 0.25s;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: 1.3;
  margin: 0 0 0.5em;
  overflow-wrap: break-word;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-dark);
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(180%) blur(8px);
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-height);
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-heading);
  white-space: nowrap;
  margin-right: auto;
}

.logo:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Both header buttons need JS; hide them if it is unavailable */
html:not(.js) .header-actions {
  display: none;
}

/* Shared style for the two icon buttons in the header (44px touch targets) */
.theme-toggle,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--color-heading);
  cursor: pointer;
}

.theme-toggle:hover,
.nav-toggle:hover {
  border-color: var(--color-border);
  background: var(--color-bg-alt);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.icon-moon {
  fill: currentcolor;
}

.icon-sun {
  display: none;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
}

.icon-sun circle {
  fill: currentcolor;
  stroke: none;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

.nav-toggle {
  flex-direction: column;
  gap: 5px;
}

.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: currentcolor;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile / tablet: nav is a drop-down panel under the header */
.primary-nav {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.primary-nav.is-open {
  display: block;
}

.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem var(--gutter);
}

.primary-nav li + li {
  border-top: 1px solid var(--color-border);
}

.primary-nav a {
  display: block;
  padding: 0.75rem 0;
  color: var(--color-text);
  font-weight: 600;
}

.primary-nav a:hover,
.primary-nav a.active {
  color: var(--color-accent);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: 3.5rem 0 3rem;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}

.hero-greeting {
  color: var(--color-muted);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.hero-name {
  font-size: clamp(2rem, 7vw, 3.2rem);
  margin-bottom: 0.25rem;
}

.hero-title {
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hero-tagline {
  color: var(--color-heading);
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-summary {
  max-width: 680px;
  color: var(--color-muted);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stats li {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stats strong {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  color: var(--color-accent);
  line-height: 1.2;
}

.stats span {
  display: block;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  text-align: center;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  border: 2px solid var(--color-accent);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: var(--color-on-accent);
}

.btn-outline {
  background: transparent;
  color: var(--color-accent);
}

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

/* ---------- Sections ---------- */
.section {
  padding: 3rem 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: clamp(1.4rem, 4.5vw, 1.75rem);
  margin-bottom: 1.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 1.5rem;
}

.about-photo {
  justify-self: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-surface);
  box-shadow: var(--shadow);
}

.about-facts {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.about-facts li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

/* ---------- Tags (skills, tech stacks) ---------- */
.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list li {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 0.92rem;
  line-height: 1.4;
}

.tag-list-small li {
  font-size: 0.82rem;
  padding: 0.15rem 0.6rem;
  background: var(--color-bg-alt);
}

/* ---------- Experience timeline ---------- */
.timeline {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--color-border);
}

.timeline-item {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 7px);
  top: 1.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg-alt);
}

.timeline-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.timeline-header h3 {
  font-size: 1.05rem;
  margin: 0;
}

.timeline-date {
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.timeline-company {
  color: var(--color-accent);
  font-weight: 600;
  margin: 0.25rem 0 0.75rem;
}

/* Bullet lists inside roles (tag lists keep their own styling) */
.timeline-item > ul:not(.tag-list) {
  margin: 0;
  padding-left: 1.1rem;
}

.timeline-item > ul:not(.tag-list) > li + li {
  margin-top: 0.35rem;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  gap: 1.75rem;
}

.skill-group h3 {
  font-size: 1.05rem;
}

/* ---------- Case study cards ---------- */
.card-grid {
  display: grid;
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card h3 {
  font-size: 1.1rem;
}

.card p {
  color: var(--color-muted);
}

.card .card-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

/* Pinned to the bottom so impact lines align across cards in a row */
.card .card-impact {
  color: var(--color-text);
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: auto;
}

.card-impact strong {
  color: var(--color-accent);
}

/* ---------- Education ---------- */
.edu-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.edu-item h3 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.edu-item p,
.edu-date {
  margin: 0;
  color: var(--color-muted);
}

.edu-date {
  font-size: 0.9rem;
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
}

.contact-intro {
  color: var(--color-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.contact-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.contact-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.contact-links a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.contact-links svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentcolor;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 1.5rem 0;
  font-size: 0.95rem;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.site-footer p {
  margin: 0;
}

.back-to-top,
.back-to-top:hover {
  color: #fff;
}

/* ---------- Scroll reveal (enabled by JS) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Responsive breakpoints (mobile-first)
   - 600px:  large phones / small tablets
   - 768px:  tablets
   - 1024px: laptops and desktops (full nav bar)
   ========================================================================== */

@media (width >= 600px) {
  :root {
    --gutter: 1.5rem;
  }

  .hero-actions {
    flex-flow: row wrap;
  }

  .contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .timeline-header {
    flex-flow: row wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
  }

  .footer-container {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

@media (width >= 768px) {
  .hero {
    padding: 5rem 0 4rem;
  }

  .section {
    padding: 4.5rem 0;
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .about-grid {
    grid-template-columns: 200px 1fr;
    gap: 2.5rem;
    align-items: start;
  }

  .about-photo {
    justify-self: start;
    width: 200px;
    height: 200px;
  }

  .timeline {
    padding-left: 1.75rem;
  }

  .timeline-item {
    padding: 1.25rem 1.5rem;
  }

  .timeline-item::before {
    left: calc(-1.75rem - 7px);
    top: 1.6rem;
  }

  .skills-grid,
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card {
    padding: 1.5rem;
  }
}

@media (width >= 1024px) {
  /* Full horizontal nav; hamburger hidden */
  .nav-toggle {
    display: none;
  }

  .primary-nav {
    display: block;
    position: static;
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .primary-nav ul {
    display: flex;
    gap: 1.5rem;
    padding: 0;
  }

  .primary-nav li + li {
    border-top: 0;
  }

  .primary-nav a {
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
  }

  .primary-nav a.active {
    border-bottom-color: var(--color-accent);
  }

  .hero {
    padding: 6.5rem 0 5rem;
  }

  .section {
    padding: 5rem 0;
  }

  .about-grid {
    grid-template-columns: 220px 1fr;
    gap: 3rem;
  }

  .about-photo {
    width: 220px;
    height: 220px;
  }

  .skills-grid,
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Print: resume-like output, always light ---------- */
@media print {
  :root,
  :root[data-theme="dark"] {
    --color-bg: #fff;
    --color-bg-alt: #fff;
    --color-surface: #fff;
    --color-text: #000;
    --color-heading: #000;
    --color-muted: #333;
    --color-accent: #2f5d8a;
    --color-border: #ccc;
    --color-footer-bg: #fff;
    --color-footer-text: #000;
  }

  .site-header,
  .hero-actions,
  .back-to-top,
  .skip-link {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .hero,
  .section {
    padding: 1rem 0;
    background: none;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .card,
  .timeline-item,
  .stats li {
    box-shadow: none;
    break-inside: avoid;
  }
}
