/* =========================================
   Mark Vegas – Art Portfolio
   style.css
   ========================================= */

/* ---- Reset & base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface-alt: #f0ede8;
  --accent: #1a1a1a;
  --accent-soft: #444444;
  --accent-muted: #888888;
  --border: #e0ddd8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --max-width: 1200px;
}

/* ---- Theme: Dark ---- */
[data-theme="dark"] {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-alt: #2a2a2a;
  --accent: #e8e8e8;
  --accent-soft: #bbbbbb;
  --accent-muted: #777777;
  --border: #333333;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* ---- Theme: Warm ---- */
[data-theme="warm"] {
  --bg: #faf3eb;
  --surface: #ffffff;
  --surface-alt: #f5ece0;
  --accent: #3d2b1f;
  --accent-soft: #6b4f3a;
  --accent-muted: #a08060;
  --border: #e6d5c3;
  --shadow: 0 2px 12px rgba(61, 43, 31, 0.08);
  --shadow-hover: 0 6px 24px rgba(61, 43, 31, 0.14);
}

/* ---- Theme: Cool ---- */
[data-theme="cool"] {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #e4eaf2;
  --accent: #1a2a3a;
  --accent-soft: #3a5068;
  --accent-muted: #7a8ea0;
  --border: #cdd8e4;
  --shadow: 0 2px 12px rgba(26, 42, 58, 0.08);
  --shadow-hover: 0 6px 24px rgba(26, 42, 58, 0.14);
}

/* ---- Theme: Midnight ---- */
[data-theme="midnight"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-alt: #21262d;
  --accent: #c9d1d9;
  --accent-soft: #8b949e;
  --accent-muted: #6e7681;
  --border: #30363d;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.55);
}

/* ---- Theme: Rose ---- */
[data-theme="rose"] {
  --bg: #fdf2f4;
  --surface: #ffffff;
  --surface-alt: #fce8ec;
  --accent: #4a1525;
  --accent-soft: #7a2e48;
  --accent-muted: #b07088;
  --border: #f0cdd5;
  --shadow: 0 2px 12px rgba(74, 21, 37, 0.08);
  --shadow-hover: 0 6px 24px rgba(74, 21, 37, 0.14);
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--accent);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

/* ---- Typography ---- */
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

p {
  font-size: 0.95rem;
  color: var(--accent-soft);
}

/* ---- Layout utilities ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================================
   LANDING PAGE
   ========================================= */

/* ---- Hero / Profile section ---- */
.hero {
  padding: 60px 0 40px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}

.hero-name {
  margin-bottom: 16px;
}

.hero-bio {
  max-width: 600px;
  font-size: 1.05rem;
  color: var(--accent-soft);
  margin-bottom: 24px;
  line-height: 1.7;
}

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--accent-soft);
  transition: border-color var(--transition), color var(--transition);
}

.contact-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-photo-wrap {
  flex-shrink: 0;
}

.hero-photo {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.hero-photo-placeholder {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

/* ---- Section divider ---- */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0 40px;
}

/* ---- Portfolio section ---- */
.portfolio-section {
  padding-bottom: 80px;
}

.portfolio-heading {
  margin-bottom: 32px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-muted);
}

/* ---- Bento grid ---- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
  align-items: start;
}

.bento-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.bento-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.bento-media-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface-alt), var(--surface));
  min-height: 220px;
  max-height: min(78vh, 760px);
}

.bento-media {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(min(78vh, 760px) - 36px);
  object-fit: contain;
  background: transparent;
  border-radius: calc(var(--radius) - 6px);
}

.bento-caption {
  padding: 0 16px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-soft);
  flex: 1;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--accent-muted);
}

.empty-state p {
  color: var(--accent-muted);
  font-size: 0.95rem;
}

/* Loading state */
.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--accent-muted);
  font-size: 0.95rem;
}

/* =========================================
   ADMIN PAGE
   ========================================= */

.admin-body {
  background: var(--bg);
}

/* ---- Password gate ---- */
.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.gate-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.gate-card h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.gate-card p {
  margin-bottom: 32px;
  color: var(--accent-muted);
  font-size: 0.9rem;
}

.gate-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 10px;
  display: none;
}

/* ---- Admin layout ---- */
.admin-layout {
  display: none;
}

.admin-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}

.admin-nav-title {
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
}

.admin-nav-links {
  display: flex;
  gap: 4px;
}

.nav-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--accent-soft);
  transition: background var(--transition), color var(--transition);
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--surface-alt);
  color: var(--accent);
}

.logout-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--accent-muted);
  transition: border-color var(--transition), color var(--transition);
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---- Admin panels ---- */
.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 28px;
}

/* ---- Form styles ---- */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 22px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-soft);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--accent);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #333;
  box-shadow: var(--shadow);
}

[data-theme="dark"] .btn-primary,
[data-theme="midnight"] .btn-primary {
  background: #e0e0e0;
  color: #121212;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="midnight"] .btn-primary:hover {
  background: #ffffff;
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="url"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
[data-theme="midnight"] input[type="text"]:focus,
[data-theme="midnight"] input[type="url"]:focus,
[data-theme="midnight"] input[type="password"]:focus,
[data-theme="midnight"] textarea:focus,
[data-theme="midnight"] select:focus {
  box-shadow: 0 0 0 3px rgba(200, 200, 200, 0.15);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: #fff0ef;
  color: #c0392b;
  border: 1px solid #f5c6c2;
}

.btn-danger:hover {
  background: #fde0de;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ---- Portfolio items list ---- */
.portfolio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.portfolio-item-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
}

.portfolio-item-thumb {
  width: 80px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-alt);
}

.portfolio-item-thumb-placeholder {
  width: 80px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--accent-muted);
}

.portfolio-item-caption {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.portfolio-item-meta {
  font-size: 0.78rem;
  color: var(--accent-muted);
}

.portfolio-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Add/Edit item form (modal-like inline) ---- */
.item-form-card {
  background: var(--surface-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 24px;
  display: none;
}

.item-form-card.open {
  display: block;
}

.item-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.item-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.upload-help {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--accent-muted);
}

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-hover);
  animation: toast-in 0.25s ease;
}

.toast.success {
  background: #1e7e4a;
}

.toast.error {
  background: #c0392b;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Status message ---- */
.status-msg {
  font-size: 0.85rem;
  padding: 8px 0;
  color: var(--accent-muted);
}

/* ---- Theme picker (admin) ---- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.theme-swatch {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  background: none;
  padding: 0;
  text-align: left;
  font-family: var(--font);
}

.theme-swatch:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.theme-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.swatch-preview {
  height: 72px;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  gap: 6px;
}

.swatch-preview span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.2);
}

.swatch-label {
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 720px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-photo-wrap {
    order: -1;
  }

  .hero-photo,
  .hero-photo-placeholder {
    width: 100px;
    height: 100px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-media-wrap {
    min-height: 160px;
    max-height: min(62vh, 520px);
    padding: 12px;
  }

  .bento-media {
    max-height: calc(min(62vh, 520px) - 24px);
  }

  .portfolio-item-card {
    grid-template-columns: 64px 1fr;
  }

  .portfolio-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .item-form-grid {
    grid-template-columns: 1fr;
  }

  .gate-card {
    padding: 32px 24px;
  }

  .admin-main {
    padding: 24px 16px 60px;
  }
}