/* Design system: palette, radius, and shadows */
:root {
  --bg: #f8fafc;         /* slate-50 */
  --text: #0f172a;       /* slate-900 */
  --muted: #64748b;      /* slate-500 */
  --border: #e2e8f0;     /* slate-200 */
  --border-strong: #cbd5e1; /* slate-300 */
  --card: #ffffff;
  --accent: #4f46e5;     /* indigo-600 */
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(2, 6, 23, 0.05);
  --shadow-2: 0 6px 16px rgba(2, 6, 23, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --text: #e6e8ee;
    --muted: #9aa4b2;
    --border: #142033;
    --border-strong: #263247;
    --card: #0e1628;
    --accent: #8b9cf5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 10px 24px rgba(0, 0, 0, 0.45);
  }
}

html { color-scheme: light dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-transform: lowercase;
}

body[data-edit-blank],
body[data-edit-blank-forced] {
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  text-transform: none;
}

body[data-edit-blank],
body[data-edit-blank-forced],
body[data-edit-blank] *,
body[data-edit-blank-forced] * {
  font-family: inherit !important;
  font-size: inherit !important;
  letter-spacing: inherit !important;
  text-transform: inherit !important;
  font-weight: inherit !important;
}

/* Typography */
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
p { margin: 0.5rem 0; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

::selection { background: rgba(79, 70, 229, 0.18); }

/* Header */
header {
  padding: 3rem 1rem 1.5rem;
  text-align: center;
}
.bio {
  color: var(--muted);
  max-width: 60ch;
  margin: 0.75rem 0 0;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  text-align: center;
  display: inline-block;
}
.contacts {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.contacts a {
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  box-shadow: var(--shadow-1);
}
.contacts a:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }

/* Projects index */
.projects {
  max-width: 1000px;
  margin: 2.5rem auto 0;
  padding: 0 1rem;
}
.projects h2 { text-align: center; color: var(--muted); margin-bottom: 1rem; }
.projects ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.projects li {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.projects li:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.projects li .project-copy { flex: 1; }
.projects li .project-logo-link {
  display: inline-flex;
}
.projects li .project-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.projects li .project-copy > a { color: inherit; text-decoration: none; font-weight: 600; font-size: 1.05rem; display: inline-block; }
.projects li .project-copy > p { color: var(--muted); margin-top: 0.25rem; }

/* placeholder card for upcoming project */
.projects li.placeholder {
  border-style: dashed;
  border-color: var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  color: var(--muted);
}
.projects li.placeholder:hover { transform: none; box-shadow: var(--shadow-1); border-color: var(--border-strong); }
.projects li.placeholder > div { font-weight: 600; letter-spacing: 0.02em; }

/* Project detail pages */
.project {
  max-width: 720px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}
.project h1 { margin-bottom: 0.5rem; }
.project h2 {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.project.noteapp {
  display: grid;
  gap: 2.25rem;
}
.project.noteapp .project-header {
  display: grid;
  gap: 0.75rem;
  text-align: center;
}
.project.noteapp .project-title {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}
.project.noteapp .project-title h1 {
  margin: 0;
  text-transform: lowercase;
}
.project.noteapp .project-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: none;
  margin-right: 0.5rem;
  border: 1px solid var(--border-strong);
}
.project.noteapp .project-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  padding: 0.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  color: inherit;
  background: transparent;
}
.project.noteapp .project-github:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.project.noteapp .project-github svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.project.noteapp .project-tagline {
  margin: 0 auto;
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
}
.project-section {
  display: grid;
  gap: 1.5rem;
}
.project-section h2 {
  margin: 0;
}
.project-section > p {
  margin: 0;
}
.project figure {
  margin: 0;
}
.feature-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}
.device-gallery {
  display: grid;
  gap: 1.25rem;
  justify-content: center;
  justify-items: center;
}
.device-gallery.trio {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.device-gallery.duo {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.device-frame {
  width: min(240px, 100%);
  border-radius: 46px;
  overflow: hidden;
}
.device-frame.centered {
  margin-left: auto;
  margin-right: auto;
}
.device-frame.gif {
  box-shadow: none;
  width: min(320px, 100%);
}
.device-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  object-fit: cover;
  background: transparent;
}
.noteapp .device-frame img {
  background: transparent;
}

footer .project-return {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(79, 70, 229, 0.08);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
footer .project-return:hover {
  background: rgba(79, 70, 229, 0.12);
  transform: translateY(-1px);
}
@media (prefers-color-scheme: dark) {
  footer .project-return {
    background: rgba(139, 156, 245, 0.16);
  }
  footer .project-return:hover {
    background: rgba(139, 156, 245, 0.2);
  }
}

/* Footer */
footer {
  margin: 3rem 0 2rem;
  text-align: center;
  color: var(--muted);
  padding: 1.5rem 1rem 0;
  border-top: 1px solid var(--border);
}

/* A11y helper */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* secret message overlay shown after gravity collapse */
.secret-message {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}
/* allow scrolling even when revealed so user can restore by scrolling up */
/* body.secret-revealed no longer forces overflow hidden */
body.secret-revealed .secret-message {
  opacity: 1; pointer-events: none;
}
.secret-message .text {
  max-width: 60ch;
  text-align: center;
  font-size: clamp(1.1rem, 1rem + 1vw, 1.5rem);
  line-height: 1.6;
  color: var(--text);
  font-weight: 600;
}

/* instantly hide main site content when secret is revealed */
body.secret-revealed header,
body.secret-revealed main,
body.secret-revealed footer {
  opacity: 0;
  visibility: hidden;
}
