/* ============================================================
   PORTFOLIO STYLESHEET — Cream & Maroon Theme
   File  : style.css
   Author: Aakash Shrestha
   Selectors: semantic elements + existing IDs only.
   ============================================================ */


/* ── 1. DESIGN TOKENS ─────────────────────────────────────────
   Cream & Maroon palette as CSS custom properties.
   ─────────────────────────────────────────────────────────── */
:root {
  /* Colour palette */
  --clr-bg:          #fdf6ec;   /* warm cream — page background   */
  --clr-surface:     #ffffff;   /* white — card / form surface     */
  --clr-surface-alt: #f5ece0;   /* slightly deeper cream — stripes */
  --clr-border:      #ddd0bc;   /* muted tan border                */
  --clr-maroon:      #6b0f1a;   /* deep maroon — primary accent    */
  --clr-maroon-dark: #4a0a12;   /* darker maroon — hover states    */
  --clr-maroon-soft: #9b3a47;   /* lighter maroon — subtle tones   */
  --clr-text:        #2c1a1a;   /* near-black warm brown — body    */
  --clr-muted:       #7a5c5c;   /* muted warm-brown — captions     */
  --clr-link:        #6b0f1a;   /* maroon links                    */
  --clr-link-hover:  #4a0a12;   /* darker on hover                 */
  --clr-btn-text:    #fdf6ec;   /* cream text on maroon button     */

  /* Typography */
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-body:    'Segoe UI', system-ui, -apple-system, sans-serif;
  --lh-base:      1.75;

  /* Layout */
  --max-width:   960px;
  --gap:         1.5rem;
  --section-pad: 4rem 1.5rem;
  --radius:      10px;
}


/* ── 2. RESET & BASE ──────────────────────────────────────────
   Box-sizing, zero margins, smooth scroll, base text styles.
   ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--lh-base);
}

/* Heading font stack (serif for classic portfolio look) */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--clr-maroon);
}

/* Typographic scale */
h1 { font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 700; letter-spacing: 0.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem);   margin-bottom: 1.5rem; }
h3 { font-size: clamp(1rem,   2vw, 1.2rem);   margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--clr-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
a:hover { color: var(--clr-link-hover); }

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


/* ── 3. HEADER ────────────────────────────────────────────────
   Full-width maroon band. h1 (cream) left, nav right.
   Flex row on desktop, column stack on mobile.
   ─────────────────────────────────────────────────────────── */
header {
  background-color: var(--clr-maroon);
  border-bottom: 4px solid var(--clr-maroon-dark);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  max-width: var(--max-width);
  margin-inline: auto;
}

header h1 {
  color: var(--clr-btn-text);   /* cream on maroon */
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}


/* ── 4. NAV ───────────────────────────────────────────────────
   Horizontal flex list with cream link text.
   Underline slide-in on hover via border-bottom transition.
   ─────────────────────────────────────────────────────────── */
nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
}

nav a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: rgba(253, 246, 236, 0.8);   /* translucent cream */
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav a:hover {
  color: var(--clr-btn-text);
  border-bottom-color: var(--clr-btn-text);
}


/* ── 5. MAIN & SECTIONS ───────────────────────────────────────
   Alternating cream / white stripes; centred content.
   h2 gets a maroon left-bar accent.
   ─────────────────────────────────────────────────────────── */
main { width: 100%; }

section {
  padding: var(--section-pad);
  border-bottom: 1px solid var(--clr-border);
}

section:nth-child(odd)  { background-color: var(--clr-bg); }
section:nth-child(even) { background-color: var(--clr-surface-alt); }

/* Centre inner content */
section > * {
  max-width: var(--max-width);
  margin-inline: auto;
}

/* Section heading accent bar */
h2 {
  position: relative;
  padding-left: 1rem;
}
h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.1em;
  bottom: 0.1em;
  width: 4px;
  border-radius: 3px;
  background-color: var(--clr-maroon);
}


/* ── 6. ABOUT SECTION ─────────────────────────────────────────
   CSS Grid layout.
   Desktop: photo (col 1) + bio (col 2) on the same row;
   "Technical Skills" h3 + dl span both columns below.
   Mobile: single column, everything stacked.
   HTML child order: h2 → p → img → h3 → dl
   ─────────────────────────────────────────────────────────── */
#about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 1.75rem;
  padding: var(--section-pad);
  max-width: var(--max-width);
  margin-inline: auto;
}

/* h2 spans both columns */
#about > h2 {
  grid-column: 1 / -1;
  max-width: none;
  margin-inline: 0;
}

/* Image: placed in col 1, row 2 (beside the bio) */
#about img {
  grid-column: 1;
  grid-row: 2;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--clr-maroon);
  box-shadow: 0 4px 16px rgba(107, 15, 26, 0.18);
  align-self: start;
}

/* Bio paragraph: placed in col 2, row 2 (beside the photo) */
#about > p {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  max-width: none;
  margin: 0;
}

/* "Technical Skills" heading spans full width below */
#about h3 {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  margin-bottom: 0;
  color: var(--clr-maroon-soft);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: none;
  margin-inline: 0;
}

/* Description list — two-column label|value grid, spans full width */
#about dl {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 1.25rem;
  align-items: baseline;
  max-width: none;
  margin-inline: 0;
}

#about dt {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-btn-text);
  background-color: var(--clr-maroon);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
  align-self: start;
}

#about dd {
  color: var(--clr-text);
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--clr-border);
}


/* ── 7. PROJECTS SECTION — portfolio cards ────────────────────
   CSS Grid: 1 col mobile → 2 col tablet → 3 col desktop.
   Cards: white surface, maroon top-border stripe, shadow lift.
   ─────────────────────────────────────────────────────────── */
#projects {
  display: grid;
  grid-template-columns: 1fr;   /* mobile: single column */
  gap: 1.5rem;
  padding: var(--section-pad);
  max-width: none;              /* section spans full width */
  background-color: var(--clr-surface-alt);
}

/* h2 spans all columns */
#projects > h2 {
  grid-column: 1 / -1;
  max-width: var(--max-width);
  margin-inline: auto;
  width: 100%;
}

/* Card treatment */
#projects article {
  background-color: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-top: 4px solid var(--clr-maroon);   /* maroon top stripe */
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 2px 8px rgba(107, 15, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

#projects article:hover {
  box-shadow: 0 8px 28px rgba(107, 15, 26, 0.18);
  transform: translateY(-4px);
}

/* Card title */
#projects article h3 {
  color: var(--clr-maroon);
  font-size: 1.1rem;
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: 0.5rem;
}

/* Card description */
#projects article p {
  flex: 1;   /* push link button to bottom */
  color: var(--clr-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 0;
}

/* "View on GitHub" button-link */
#projects article a {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--clr-btn-text);
  background-color: var(--clr-maroon);
  border: 2px solid var(--clr-maroon);
  border-radius: 5px;
  padding: 0.4rem 0.9rem;
  letter-spacing: 0.04em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#projects article a:hover {
  background-color: var(--clr-maroon-dark);
  border-color: var(--clr-maroon-dark);
}


/* ── 8. CONTACT SECTION ───────────────────────────────────────
   Flexbox column form; labels above inputs; full-width fields;
   maroon submit button with hover/active states.
   ─────────────────────────────────────────────────────────── */
#contact form {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 600px;
}

/* Each <p> wraps one label + one input */
#contact form p {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

#contact label {
  font-family: var(--font-body);
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-maroon);
}

#contact input[type="text"],
#contact input[type="email"],
#contact textarea {
  width: 100%;
  background-color: var(--clr-surface);
  color: var(--clr-text);
  border: 1.5px solid var(--clr-border);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--lh-base);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

#contact input[type="text"]:hover,
#contact input[type="email"]:hover,
#contact textarea:hover {
  border-color: var(--clr-maroon-soft);
}

#contact button[type="submit"] {
  align-self: flex-start;
  background-color: var(--clr-maroon);
  color: var(--clr-btn-text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--clr-maroon);
  border-radius: 6px;
  padding: 0.65rem 2rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background-color 0.2s ease, transform 0.15s ease,
              box-shadow 0.2s ease;
}

#contact button[type="submit"]:hover {
  background-color: var(--clr-maroon-dark);
  border-color: var(--clr-maroon-dark);
  box-shadow: 0 4px 16px rgba(107, 15, 26, 0.3);
  transform: translateY(-2px);
}

#contact button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}


/* ── 9. FOOTER ────────────────────────────────────────────────
   Maroon band matching the header; centred cream copyright.
   ─────────────────────────────────────────────────────────── */
footer {
  background-color: var(--clr-maroon);
  border-top: 4px solid var(--clr-maroon-dark);
  padding: 1.5rem var(--gap);
  text-align: center;
}

footer p {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(253, 246, 236, 0.75);
  margin: 0;
}


/* ── 10. ACCESSIBILITY — :focus-visible ───────────────────────
   Visible maroon focus ring for keyboard navigation.
   Never removed without a replacement.
   ─────────────────────────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--clr-maroon);
  outline-offset: 3px;
  border-radius: 4px;
}

#contact input[type="text"]:focus-visible,
#contact input[type="email"]:focus-visible,
#contact textarea:focus-visible {
  border-color: var(--clr-maroon);
  box-shadow: 0 0 0 3px rgba(107, 15, 26, 0.2);
  outline: none;   /* box-shadow acts as the focus ring here */
}


/* ── 11. RESPONSIVE ───────────────────────────────────────────
   Mobile-first. Breakpoints:
     < 600 px : single-column, stacked nav, no float
     ≥ 600 px : 2-col projects, row header, side-by-side about
     ≥ 900 px : 3-col projects
   ─────────────────────────────────────────────────────────── */

/* ── MOBILE (< 600 px) ──────────────────────────────────────── */
@media (max-width: 599px) {
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }

  /* Stack header vertically on mobile */
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  nav ul { flex-direction: column; gap: 0.4rem; }

  /* About: single-column stack on mobile */
  #about {
    grid-template-columns: 1fr;
  }

  #about img {
    grid-column: 1;
    grid-row: auto;
    width: 120px;
    height: 120px;
    justify-self: center;
  }

  #about > p {
    grid-column: 1;
    grid-row: auto;
  }

  #about h3,
  #about dl {
    grid-column: 1;
  }

  /* Skills dl: collapse to single column */
  #about dl { grid-template-columns: 1fr; }
  #about dt  { display: inline-block; margin-top: 0.5rem; }
  #about dd  {
    padding-left: 0.6rem;
    border-left: 3px solid var(--clr-border);
    border-bottom: none;
  }

  #contact button[type="submit"] {
    width: 100%;
    text-align: center;
    align-self: stretch;
  }
}

/* ── TABLET+ (≥ 600 px) ─────────────────────────────────────── */
@media (min-width: 600px) {

  /* Photo grows a bit on tablet */
  #about img {
    width: 180px;
    height: 180px;
  }

  /* Projects: two equal columns */
  #projects { grid-template-columns: repeat(2, 1fr); }
  #projects > h2 { grid-column: 1 / -1; }
}

/* ── DESKTOP (≥ 900 px) ─────────────────────────────────────── */
@media (min-width: 900px) {
  #projects { grid-template-columns: repeat(3, 1fr); }
  #projects > h2 { grid-column: 1 / -1; }

  /* If last card would orphan, span 2 cols */
  #projects > article:last-child:nth-child(3n + 2) {
    grid-column: span 2;
  }
}
