/* ─── Fonts ──────────────────────────────────────────── */
/* Drop your font files into public/fonts/ and update the src paths below */

@font-face {
  font-family: "GT Alpina";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/GT-Alpina-Standard-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "GT Alpina";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/GT-Alpina-Standard-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Neue Haas Grotesk Text Pro";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/NHaasGroteskTXPro-55Rg.woff2") format("woff2");
}

@font-face {
  font-family: "Neue Haas Grotesk Text Pro";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/NHaasGroteskTXPro-65Md.woff2") format("woff2");
}

@font-face {
  font-family: "Neue Haas Grotesk Text Pro";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/NHaasGroteskTXPro-75Bd.woff2") format("woff2");
}

/* ─── Colors ─────────────────────────────────────────── */
:root {
  --blue: #7EBDFF;
  --cream: #F2EDEE;
  --ink: #000000;
  --highlight: #F0E00C;
  --card-bg: rgba(0, 69, 89, 0.09);
  --card-bg-hover: rgba(0, 69, 89, 0.15); 
}

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

html { height: 100%; }

body {
  min-height: 100%;
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: var(--blue);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Layout ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 70% 30%;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "featured  bio"
    "lists     bio"
    "footer    bio";
  min-height: 100vh;
}

.articles-featured { grid-area: featured; }
.articles-lists    { grid-area: lists; }
.site-footer       { grid-area: footer; }

.bio-panel {
  grid-area: bio;
  background-color: var(--cream);
  padding: 80px 40px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ─── Name ───────────────────────────────────────────── */
.name {
  font-family: "GT Alpina", Georgia, serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 30px;
  color: var(--ink);
  align-self: flex-start;
  margin-bottom: 30px;
}

/* ─── Featured article cards ─────────────────────────── */
.articles-featured {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 80px 60px 0;
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.article-card {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 27px;
  padding: 36px;
  background-color: var(--card-bg);
  mix-blend-mode: multiply;
  text-decoration: none;
  color: inherit;
  width: fit-content;
  margin-bottom: -1px; /* slight overlap */
  transition: all 200ms ease;
}

.article-card:hover {
  background-color: var(--card-bg-hover);
  transform: rotate(var(--rotation-hover, 3deg));
  transition: all 200ms ease;
}

/* Random rotation from per-article CSS custom properties */
.article-card {
  transform: rotate(var(--rotation, 1deg));
  margin-top: -5px;
}

/* Alternate sides: odd = left zone, even = right zone */
.article-card:nth-child(odd) {
  margin-left: calc((4% + var(--margin-offset, 0.5) * 12%));
}
.article-card:nth-child(even) {
  margin-left: calc((22% + var(--margin-offset, 0.5) * 14%));
}

/* Featured cards: h1 is nth-child(1), cards start at nth-child(2)
   Pattern of 4: left → right → left/middle → right → repeat
   Right = all odd nth-children (3,5,7…)
   Left  = nth-child(4n+2): 2, 6, 10…
   Left/middle = nth-child(4n): 4, 8, 12… */
.articles-featured .article-card:nth-child(odd) {
  margin-left: calc(30% + var(--margin-offset, 0.5) * 14%);
  flex-direction: row-reverse;
}
.articles-featured .article-card:nth-child(4n+2) {
  margin-left: 0;
}
.articles-featured .article-card:nth-child(4n) {
  margin-left: calc(8% + var(--margin-offset, 0.5) * 10%);
}
.articles-featured .article-card:first-of-type {
  transform: rotate(0deg);
}
.articles-featured .article-card:first-of-type:hover {
  transform: rotate(2deg);
}

/* ─── Article image ──────────────────────────────────── */
.article-image {
  flex-shrink: 0;
  width: 250px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  transform: rotate(var(--img-rotation, -1deg));
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) brightness(1.69);
  mix-blend-mode: multiply;
}

/* ─── Article text (cards) ───────────────────────────── */
.article-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 224px;
}

.article-text h2 {
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 22px;
  color: rgba(0,0,0,0.92);
}

.article-text p {
  font-family: "GT Alpina", Georgia, serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 18px;
  color: rgba(0,0,0,0.92);
}

/* ─── Article sections (text list) ──────────────────── */
.articles-lists {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 60px;
  padding: 60px;
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.article-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.section-label {
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: normal;
  color: var(--ink);
}

.article-row {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: opacity 150ms ease;
}

.article-row:hover {
  opacity: 0.6;
}

.article-row-rule {
  width: 100%;
  height: 1px;
  background-color: var(--ink);
  margin-bottom: 16px;
}

.article-row-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 24px;
}

.article-row-content h2 {
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: normal;
  color: var(--ink);
}

.article-row-content p {
  font-family: "GT Alpina", Georgia, serif;
  font-weight: 400;
  font-size: 14px;
  line-height: normal;
  color: var(--ink);
}

/* ─── Bio (right panel) ──────────────────────────────── */
.bio-headline {
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 30px;
  color: var(--ink);
}

.bio-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 50px;
}

.bio-body p {
  font-family: "GTAlpina-Regular", "GT Alpina", Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 28px;
  color: var(--ink);
}

mark {
  position: relative;
  background: transparent;
  color: inherit;
}

mark::before {
  content: '';
  position: absolute;
  inset: -3px -3px;
  background: var(--highlight);
  z-index: -1;
}

/* ─── Bio email ──────────────────────────────────────── */
.bio-email {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 40px;
}

.bio-email-rule {
  width: 100%;
  height: 1px;
  background-color: #0D0B0A;
}

.bio-email a {
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 28px;
  color: var(--ink);
  text-decoration: none;
}

.bio-email a:hover {
  text-decoration: underline;
}

/* ─── Footer ─────────────────────────────────────────── */
.site-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 40px 60px;
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.site-footer::before {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background-color: #0D0B0A;
}

.site-footer-row {
  display: flex;
  justify-content: space-between;
  font-family: "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 28px;
  color: var(--ink);
}

.site-footer-row a {
  text-decoration: none;
  color: var(--ink);
}

.site-footer-row a:hover {
  text-decoration: underline;
}

/* ─── Admin ──────────────────────────────────────────── */
.admin-body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f4f4f4;
  min-height: 100vh;
  padding: 48px;
  color: #111;
}

.admin-body h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
}

.admin-body a {
  color: #555;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  margin-left: 12px;
}

.add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
  max-width: 700px;
}

.add-form input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  outline: none;
}

.add-form input:focus {
  border-color: var(--blue);
}

.add-form button {
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  background: var(--blue);
  color: var(--ink);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.add-form button:hover {
  background: #5ba8f5;
}

.edit-fields {
  display: flex;
  gap: 16px;
  max-width: 700px;
  margin-bottom: 24px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
}

.edit-preview {
  flex-shrink: 0;
}

.edit-preview img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
  display: block;
}

.edit-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edit-inputs label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.edit-inputs input,
.edit-inputs textarea,
.edit-inputs select {
  padding: 7px 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fafafa;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.edit-inputs input:focus,
.edit-inputs textarea:focus,
.edit-inputs select:focus {
  border-color: var(--blue);
  background: #fff;
}

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.badge-featured,
.badge-hidden {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-bottom: 6px;
}

.badge-featured {
  color: #888;
  border: 1px solid #ddd;
}

.badge-hidden {
  color: #a00;
  border: 1px solid #f5c0c0;
  background: #fff0f0;
}

.article-number {
  color: #111;
  font-size: 18px;
  font-weight: 400;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}


.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.edit-actions button[type="submit"] {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  background: var(--blue);
  color: #000;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.edit-actions button[type="button"] {
  padding: 8px 16px;
  font-size: 14px;
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
}

.alert {
  max-width: 700px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 24px;
}

.alert-error { background: #ffe0e0; color: #a00; border: 1px solid #f5c0c0; }
.alert-success { background: #e0f5e0; color: #060; border: 1px solid #b0ddb0; }

.admin-section-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #999;
  margin: 28px 0 10px;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
}

.admin-article {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px;
}

.admin-article img {
  width: 80px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #eee;
}

.admin-article-info {
  flex: 1;
  min-width: 0;
}

.admin-article-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-article-info span {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: fit-content;
}

.admin-article-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.admin-article-order form { margin: 0; }

.admin-article-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.admin-article-actions form { margin: 0; }

.btn {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  background: #f8f8f8;
  color: #333;
}

.btn:hover { background: #eee; }

.btn-danger {
  border-color: #f5c0c0;
  color: #a00;
  background: #fff0f0;
}

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

.empty-state {
  color: #999;
  font-size: 14px;
  padding: 24px 0;
}

/* ─── Tablet ─────────────────────────────────────────── */
@media (max-width: 1375px) {
  /* Featured cards: h1 is nth-child(1), cards start at nth-child(2)
    Pattern of 4: left → right → left/middle → right → repeat
    Right = all odd nth-children (3,5,7…)
    Left  = nth-child(4n+2): 2, 6, 10…
    Left/middle = nth-child(4n): 4, 8, 12… */
  .articles-featured .article-card:nth-child(odd) {
    margin-left: calc(15% + var(--margin-offset, 0.5) * 14%);
    flex-direction: row-reverse;
  }
  .articles-featured .article-card:nth-child(4n+2) {
    margin-left: 0;
  }
  .articles-featured .article-card:nth-child(4n) {
    margin-left: calc(2% + var(--margin-offset, 0.5) * 10%);
  }
  .articles-featured .article-card:first-of-type {
    transform: rotate(0deg);
  }


}

/* ─── Mobile ─────────────────────────────────────────── */
@media (max-width: 1145px) {
  .layout {
    display: flex;
    flex-direction: column;
  }

  .articles-featured { order: 1; }
  .bio-panel         { order: 2; }
  .articles-lists    { order: 3; }
  .site-footer       { order: 4; }

  .bio-panel {
    position: static;
    height: auto;
    background-color: var(--cream);
    margin: 40px;
    padding: 40px;
  }

  .articles-featured {
    align-items: center;
  }

  .name {
    text-align: center;
    margin-left: 0 !important;
    align-self: stretch;
    padding: 0 0 20px;
  }

  .bio-email a {
    font-size: 18px;
  }

  .article-card,
  .articles-featured .article-card:nth-child(odd),
  .articles-featured .article-card:nth-child(even),
  .articles-featured .article-card:nth-child(4n+2),
  .articles-featured .article-card:nth-child(4n),
  .articles-featured .article-card:nth-child(4n+1),
  .articles-featured .article-card:nth-child(4n+3) {
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    margin-bottom: 4px;
    width: 100%;
    max-width: 360px;
    margin: 10px 0;
  }

  .article-image {
    width: 100%;
    aspect-ratio: 3 / 2;
  }

  .article-text {
    width: 100%;
  }

  .articles-lists {
    flex-direction: column;
    padding: 40px;
    gap: 70px;
  }

  .site-footer {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding: 40px;
  }
}
