/* ==========================================================================
   Susan Karki, portfolio
   Structure: tokens, base, layout, components, responsive
   ========================================================================== */

/* Design tokens */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #111c27;
  --muted: #546270;
  --line: #dce2e8;
  --accent: #0d7a86;
  --accent-ink: #ffffff;
  --accent-soft: #d9eef0;

  --radius: 8px;
  --max: 1080px;
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151c;
    --surface: #151f29;
    --ink: #e8edf2;
    --muted: #9aa8b5;
    --line: #25323e;
    --accent: #4cc3cf;
    --accent-ink: #06242a;
    --accent-soft: #16363b;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-head); line-height: 1.15; }
p { margin: 0 0 1rem; }
ul, dl { margin: 0; padding: 0; list-style: none; }

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

.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 20;
  padding: .5rem 1rem; background: var(--ink); color: var(--bg); border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: .7rem 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 600 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; }
.brand { font: 700 1.2rem var(--font-head); text-decoration: none; }
.site-nav ul { display: flex; gap: 2rem; }
.site-nav a { text-decoration: none; font-weight: 500; color: var(--muted); }
.site-nav a:hover { color: var(--ink); }

.nav-toggle { display: none; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; background: none; cursor: pointer; }
.nav-toggle span { display: block; width: 1.4rem; height: 2px; margin: 5px auto; background: var(--ink); transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero { padding: clamp(3rem, 8vw, 6rem) 0; }
.hero-inner { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero h1 { font-size: clamp(2.9rem, 8vw, 5rem); font-weight: 700; letter-spacing: -.025em; line-height: 1; }
.role { margin: 1rem 0 1.25rem; color: var(--accent); font: 600 1.35rem var(--font-head); }
.lead { max-width: 32rem; font-size: 1.2rem; color: var(--muted); }

.portrait {
  position: relative; margin: 0; aspect-ratio: 4 / 5;
  border-radius: var(--radius); background: var(--accent-soft);
  box-shadow: 10px 10px 0 var(--line);
  overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* Shown when an image file is missing */
[data-fallback].is-missing { visibility: hidden; }
.portrait:has(.is-missing)::after {
  content: "SK"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--accent); font: 700 4rem var(--font-head);
}

/* Sections */
.section { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }
.section-grid { display: grid; grid-template-columns: 200px 1fr; gap: 2rem; }
.section h2 { font-size: 1.5rem; }
.section-grid > div { max-width: 44rem; }
.section-grid > .project-list,
.section-grid > .resume { max-width: none; }

.skills { margin-top: 1.75rem; border-top: 1px solid var(--line); }
.skills div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }

/* Projects */
.project { display: grid; grid-template-columns: 260px 1fr; gap: 1.75rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.project:first-child { padding-top: 0; border-top: 0; }
.project h3 { font-size: 1.45rem; margin-bottom: .5rem; }
.project p { color: var(--muted); max-width: 40rem; }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tags li { padding: .1rem .55rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: .875rem; }
.project .links { display: flex; gap: 1.5rem; margin: 0; font-weight: 600; }
.project .links a { color: var(--accent); text-underline-offset: 4px; }

/* Flat wireframe previews, replace with screenshots when available */
.thumb {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--line), var(--line)),
    linear-gradient(var(--accent-soft), var(--accent-soft)),
    linear-gradient(var(--line), var(--line)),
    linear-gradient(var(--line), var(--line));
  background-repeat: no-repeat;
  background-size: 34% 8px, 100% 46%, 70% 8px, 50% 8px;
  background-position: 14px 14px, 0 36px, 14px calc(36px + 46% + 16px), 14px calc(36px + 46% + 34px);
}
.thumb-vertical {
  background-image:
    linear-gradient(var(--accent), var(--accent)),
    linear-gradient(var(--accent-soft), var(--accent-soft));
  background-size: 20% 7px, 30% 84%;
  background-position: 50% 74%, 50% 50%;
}

/* Resume */
.resume { display: grid; grid-template-columns: 1fr 340px; gap: 2.5rem; align-items: start; }
.cv-preview { margin: 0; }
.cv-button {
  display: block; width: 100%; padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); overflow: hidden; cursor: zoom-in;
}
.cv-button img { width: 100%; }

dialog { width: min(92vw, 880px); max-height: 92vh; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(8, 14, 20, .7); }
dialog form { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
dialog img { width: 100%; }

/* Contact */
.contact-list { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.contact-list li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.contact-list span { color: var(--muted); }
.contact-list a { font-weight: 500; text-underline-offset: 4px; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--accent); }

/* Footer */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.site-footer p { margin: 0; }

/* Responsive */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 300px; }
  .section-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .resume { grid-template-columns: 1fr; }
  .cv-preview { max-width: 360px; }
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }
  .site-nav a { display: block; padding: .9rem 0; border-top: 1px solid var(--line); }
  .project { grid-template-columns: 1fr; gap: 1.25rem; }
  .thumb { max-width: 320px; }
  .skills div, .contact-list li { grid-template-columns: 1fr; gap: .1rem; }
}

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