:root {
  color-scheme: dark;
  --bg: #111315;
  --surface: #181b1f;
  --surface-raised: #20242a;
  --text: #f2efe9;
  --muted: #a9adb3;
  --line: #343942;
  --accent: #f0b35a;
  --accent-strong: #ffca7a;
  --cyan: #7cc9d8;
  --danger: #ef6b64;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(20, 23, 27, 0.88), rgba(17, 19, 21, 1) 52%),
    url("https://images.unsplash.com/photo-1511512578047-dfb367046420?auto=format&fit=crop&w=1800&q=80")
      center top / cover fixed;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.top-nav {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 21, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.nav-brand {
  max-width: 44vw;
  overflow: hidden;
  color: var(--text);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.nav-links a,
.nav-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 11px;
  color: var(--muted);
  font-weight: 760;
}

.nav-links a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: rgba(240, 179, 90, 0.08);
}

.nav-status {
  border-color: rgba(124, 201, 216, 0.42);
  color: var(--cyan);
}

.profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  min-height: 56vh;
  padding: 28px 0 32px;
  scroll-margin-top: 88px;
}

.profile-main {
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.profile h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(3.4rem, 12vw, 9.8rem);
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
}

.specialization {
  margin: 22px 0 0;
  max-width: 720px;
  color: #d8dbe0;
  font-size: clamp(1.2rem, 2.8vw, 2rem);
  line-height: 1.25;
}

.contact-row,
.social-row,
.project-links,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.contact-row {
  margin-top: 24px;
  color: var(--muted);
}

.social-row {
  justify-content: flex-end;
  max-width: 320px;
}

.pill,
.button,
.icon-button,
.file-label {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pill,
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  color: #eef0f3;
  background: rgba(24, 27, 31, 0.7);
  backdrop-filter: blur(10px);
}

.pill:hover,
.file-label:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.section-header {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 10px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.cv-section,
#portfolio {
  scroll-margin-top: 88px;
}

.cv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.cv-summary,
.stack-card,
.experience-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.86);
}

.cv-summary {
  padding: 22px;
}

.cv-summary > p {
  margin: 0;
  color: #d8dbe0;
  font-size: 1.1rem;
  line-height: 1.65;
}

.cv-highlights {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.cv-highlights li {
  position: relative;
  padding-left: 22px;
  color: #c9cdd2;
  line-height: 1.55;
}

.cv-highlights li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(240, 179, 90, 0.42);
}

.cv-stack {
  display: grid;
  gap: 12px;
}

.stack-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.stack-card h3,
.experience-item h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(124, 201, 216, 0.26);
  border-radius: 8px;
  padding: 6px 9px;
  color: #d7f4f8;
  background: rgba(124, 201, 216, 0.08);
}

.experience-list {
  display: grid;
  gap: 12px;
}

.experience-item {
  display: grid;
  grid-template-columns: minmax(190px, 0.78fr) minmax(120px, 0.36fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: start;
  padding: 16px;
}

.experience-item p,
.experience-item time {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.experience-item > p {
  color: #c9cdd2;
}

.section-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.project-count {
  color: var(--muted);
  white-space: nowrap;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 18px;
}

.project-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.88);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  transform: translateY(0) scale(1);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background-color 220ms ease;
  will-change: transform;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(240, 179, 90, 0.24), transparent 35%),
    linear-gradient(315deg, rgba(124, 201, 216, 0.16), transparent 42%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: rgba(240, 179, 90, 0.78);
  background: rgba(29, 33, 38, 0.94);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(240, 179, 90, 0.16),
    0 0 34px rgba(240, 179, 90, 0.12);
  transform: translateY(-7px) scale(1.015);
}

.project-card:hover::before,
.project-card:focus-within::before {
  opacity: 1;
}

.project-media {
  position: relative;
  z-index: 0;
  display: grid;
  gap: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0d0f11;
}

.project-media img,
.project-media iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  transform: scale(1);
  transition:
    transform 360ms ease,
    filter 360ms ease;
}

.project-card:hover .project-media img,
.project-card:focus-within .project-media img,
.project-card:hover .project-media iframe,
.project-card:focus-within .project-media iframe {
  filter: saturate(1.12) contrast(1.05);
  transform: scale(1.045);
}

.media-stack {
  display: grid;
  grid-template-columns: repeat(var(--media-count), minmax(0, 1fr));
}

.media-stack > *:not(:first-child) {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.project-body {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.project-title-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.project-card h3 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.2;
  transition: color 220ms ease;
}

.project-card:hover h3,
.project-card:focus-within h3 {
  color: var(--accent-strong);
}

.project-card p {
  margin: 0;
  color: #c9cdd2;
  line-height: 1.58;
  white-space: pre-line;
}

.project-links {
  padding-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card::before,
  .project-media img,
  .project-media iframe,
  .project-card h3 {
    transition: none;
  }

  .project-card:hover,
  .project-card:focus-within,
  .project-card:hover .project-media img,
  .project-card:focus-within .project-media img,
  .project-card:hover .project-media iframe,
  .project-card:focus-within .project-media iframe {
    transform: none;
  }
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(24, 27, 31, 0.72);
  text-align: center;
}

.admin-bar {
  position: sticky;
  z-index: 20;
  top: 66px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 21, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.admin-actions {
  justify-content: flex-end;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.button {
  gap: 8px;
  padding: 10px 15px;
  font-weight: 760;
}

.button-primary {
  border-color: #c88535;
  color: #15120e;
  background: var(--accent);
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.button-danger {
  border-color: rgba(239, 107, 100, 0.58);
  background: rgba(239, 107, 100, 0.14);
}

.button-danger:hover {
  border-color: var(--danger);
  color: #ffd3d0;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.floating-add {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  width: 58px;
  min-height: 58px;
  border-color: #c88535;
  color: #15120e;
  background: var(--accent);
  box-shadow: var(--shadow);
  font-size: 2rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.72);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-panel-small {
  width: min(440px, 100%);
}

.modal-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 720;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #111418;
  padding: 12px 13px;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 31, 0.92);
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: 1.5rem;
}

.login-error {
  min-height: 22px;
  color: #ffb3ae;
  font-weight: 700;
}

.toolbar-file {
  position: relative;
  overflow: hidden;
}

.toolbar-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .profile {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: 52vh;
    gap: 22px;
  }

  .top-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-brand {
    max-width: 100%;
  }

  .nav-links {
    justify-content: flex-start;
    width: 100%;
  }

  .nav-links a,
  .nav-status {
    flex: 1 1 auto;
  }

  .profile h1 {
    font-size: clamp(3rem, 20vw, 5.8rem);
  }

  .social-row {
    justify-content: flex-start;
    max-width: none;
  }

  .section-header,
  .admin-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-bar {
    top: 112px;
  }

  .profile,
  .cv-section,
  #portfolio {
    scroll-margin-top: 176px;
  }

  .cv-layout,
  .experience-item {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .button {
    flex: 1 1 auto;
  }

  .floating-add {
    right: 16px;
    bottom: 16px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .button {
    width: 100%;
  }
}
