/* ============================================================
   Portfolio stylesheet
   Modern, minimal, responsive, and accessible.
   Uses only CSS for decoration (no copyrighted imagery).
   ============================================================ */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #1a2233;
  --color-muted: #5b6577;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-border: #e2e8f0;
  --color-success-bg: #ecfdf5;
  --color-success-text: #065f46;
  --color-error-bg: #fef2f2;
  --color-error-text: #991b1b;
  --color-warning-bg: #fffbeb;
  --color-warning-text: #92400e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 10px 25px rgba(16, 24, 40, 0.10);
  --max-width: 1080px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f1420;
    --color-bg-alt: #161c2b;
    --color-surface: #1b2233;
    --color-text: #e8ecf3;
    --color-muted: #a2acbd;
    --color-primary: #60a5fa;
    --color-primary-dark: #3b82f6;
    --color-border: #2a3350;
    --color-success-bg: #052e24;
    --color-success-text: #6ee7b7;
    --color-error-bg: #3a1414;
    --color-error-text: #fca5a5;
    --color-warning-bg: #3a2c0a;
    --color-warning-text: #fcd34d;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible focus states for keyboard accessibility. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* Skip link for screen-reader / keyboard users. */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ------------------------------ Header / nav ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.05rem;
}
.nav__brand:hover { text-decoration: none; }
.nav__logo { color: var(--color-primary); }
.nav__menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.nav__menu a {
  color: var(--color-muted);
  font-weight: 500;
}
.nav__menu a:hover { color: var(--color-primary); text-decoration: none; }
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.4rem;
}
.nav__bar {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 720px) {
  .nav__toggle { display: flex; }
  .nav__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav__menu.is-open { max-height: 340px; }
  .nav__menu li { border-top: 1px solid var(--color-border); }
  .nav__menu a { display: block; padding: 0.9rem 1.25rem; }
}

/* ------------------------------ Buttons ------------------------------ */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border);
}
.btn--ghost:hover { border-color: var(--color-primary); }
.btn--danger {
  background: #dc2626;
  color: #fff;
}
.btn--danger:hover { background: #b91c1c; }
.btn--small { padding: 0.4rem 0.9rem; font-size: 0.88rem; }

/* ------------------------------ Hero ------------------------------ */
.hero {
  padding: 5.5rem 0 4.5rem;
  background:
    radial-gradient(1200px 400px at 70% -10%,
      color-mix(in srgb, var(--color-primary) 18%, transparent), transparent),
    var(--color-bg);
}
.hero__eyebrow {
  color: var(--color-primary);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}
.hero__name { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0; }
.hero__title {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--color-muted);
  font-weight: 600;
  margin: 0.4rem 0 1rem;
}
.hero__intro {
  max-width: 620px;
  color: var(--color-muted);
  font-size: 1.08rem;
  margin: 0 0 1.8rem;
}
.hero__actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ------------------------------ Sections ------------------------------ */
.section { padding: 4rem 0; }
.section--alt { background: var(--color-bg-alt); }
.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 0.6rem;
}
.section__title::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  margin-top: 0.5rem;
}
.section__lead { color: var(--color-muted); max-width: 640px; margin-bottom: 2rem; }
.about { max-width: 760px; font-size: 1.05rem; color: var(--color-text); }

/* ------------------------------ Cards (projects) ------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card__title { font-size: 1.2rem; }
.card__desc { color: var(--color-muted); flex: 1; }
.card__tags {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.card__tags li {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
}
.card__link { font-weight: 600; }

/* ------------------------------ Skills ------------------------------ */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.skills__heading { font-size: 1.05rem; margin-bottom: 0.7rem; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

/* ------------------------------ Timeline ------------------------------ */
.timeline { list-style: none; padding: 0; margin: 0; max-width: 760px; }
.timeline__item {
  position: relative;
  padding: 0 0 1.8rem 1.5rem;
  border-left: 2px solid var(--color-border);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
}
.timeline__date { font-size: 0.85rem; color: var(--color-primary); font-weight: 600; }
.timeline__role { margin: 0.2rem 0 0; font-size: 1.1rem; }
.timeline__org { margin: 0.1rem 0 0.4rem; color: var(--color-muted); font-weight: 500; }
.timeline__desc { margin: 0; color: var(--color-muted); }

/* ------------------------------ Contact / forms ------------------------------ */
.contact { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2.5rem; align-items: start; }
.contact__direct { color: var(--color-muted); }
@media (max-width: 780px) { .contact { grid-template-columns: 1fr; } }

.form { display: flex; flex-direction: column; gap: 1rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }
.form__field { display: flex; flex-direction: column; gap: 0.35rem; }
.form__field label { font-weight: 600; font-size: 0.92rem; }
.input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}
.input:focus { border-color: var(--color-primary); }
.textarea { resize: vertical; min-height: 120px; }
.form__error { color: var(--color-error-text); font-size: 0.85rem; }

/* ------------------------------ Flash messages ------------------------------ */
.flash-container {
  max-width: var(--max-width);
  margin: 1rem auto 0;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.flash {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
}
.flash--success { background: var(--color-success-bg); color: var(--color-success-text); }
.flash--error { background: var(--color-error-bg); color: var(--color-error-text); }
.flash--warning { background: var(--color-warning-bg); color: var(--color-warning-text); }

/* ------------------------------ Footer ------------------------------ */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  padding: 2rem 0;
  text-align: center;
}
.footer__name { font-weight: 700; margin: 0 0 0.3rem; }
.footer__contact { margin: 0 0 0.3rem; color: var(--color-muted); }
.footer__contact a { color: var(--color-primary); }
.footer__copy { color: var(--color-muted); font-size: 0.85rem; margin: 0.5rem 0 0; }

/* ============================================================
   Admin panel
   ============================================================ */
.admin-body { background: var(--color-bg-alt); }
.admin-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.admin-header .nav__menu a { color: var(--color-muted); }
.admin-main { padding: 2.5rem 0; min-height: 70vh; }

.auth-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.4rem; text-align: center; }
.auth-card .form { margin-top: 1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.stat__num { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.stat__label { color: var(--color-muted); font-size: 0.9rem; }

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.panel h2 { font-size: 1.2rem; margin-top: 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.table th { color: var(--color-muted); font-weight: 600; }
.table tr:hover td { background: var(--color-bg-alt); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge--new { background: #dbeafe; color: #1e40af; }
.badge--read { background: #e5e7eb; color: #374151; }
.badge--archived { background: #fef3c7; color: #92400e; }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 0.85rem;
}
.filters a:hover, .filters a.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  text-decoration: none;
}

.detail-grid { display: grid; grid-template-columns: 160px 1fr; gap: 0.6rem 1rem; }
.detail-grid dt { color: var(--color-muted); font-weight: 600; }
.detail-grid dd { margin: 0; }
.message-box {
  white-space: pre-wrap;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.5rem;
}

.inline-form { display: inline; }
.field-block { margin-bottom: 1.5rem; }
.field-block label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.actions-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.muted { color: var(--color-muted); }
.back-link { display: inline-block; margin-bottom: 1rem; }

/* ------------------------------ Error pages ------------------------------ */
.error-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.error-page__code { font-size: 5rem; font-weight: 800; color: var(--color-primary); margin: 0; }
