:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #111111;
  --panel-2: #171717;
  --text: #fff2df;
  --muted: #cbbdae;
  --line: #2a2926;
  --accent: #ff5a12;
  --accent-soft: #ffd7b7;
  --silver: #dedbd3;
  --deep: #120c09;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(116deg, transparent 0 75%, rgba(222, 219, 211, 0.13) 75% 77%, rgba(255, 90, 18, 0.28) 77% 100%),
    radial-gradient(circle at 88% 12%, rgba(255, 90, 18, 0.16), transparent 32rem),
    linear-gradient(135deg, var(--bg), #14100e 48%, var(--deep));
  font-family: Inter, Arial, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 72%);
}

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

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

.home-shell {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100vh;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
  text-align: center;
}

.home-hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-height: min(760px, calc(100vh - 96px));
  align-items: center;
  width: 100%;
}

.home-primary {
  display: grid;
  justify-items: center;
  transition: transform 180ms ease;
}

.logo-link {
  display: grid;
  place-items: center;
  width: clamp(190px, 24vw, 340px);
  margin: 0 auto 34px;
  transition: transform 180ms ease, filter 180ms ease;
}

.logo-link:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

.logo-image,
.mini-logo-image {
  display: none;
}

.logo-image[src],
.mini-logo-image[src] {
  display: block;
}

.logo-image {
  width: 100%;
  height: auto;
  max-height: 44vh;
  object-fit: contain;
  filter: drop-shadow(0 34px 80px rgba(0, 0, 0, 0.66));
}

.mini-logo-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.logo-image[src] + .logo-fallback,
.mini-logo-image[src] + .mini-logo-fallback {
  display: none;
}

.logo-fallback {
  display: grid;
  place-items: center;
  width: clamp(172px, 26vw, 300px);
  aspect-ratio: 1;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(3.8rem, 9vw, 7.5rem);
  font-weight: 700;
}

.logo-fallback span {
  transform: translateY(-0.05em);
}

.home-intro,
.story-hero {
  width: min(820px, 100%);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.05;
}

h1 {
  margin-bottom: 20px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(2.35rem, 7vw, 5.8rem);
}

.home-intro p:not(.eyebrow),
.story-hero p {
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.foundation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  margin-top: 52px;
  border: 1px solid var(--line);
  background: var(--line);
  text-align: left;
}

.foundation article {
  min-height: 210px;
  padding: 30px;
  background: rgba(12, 12, 12, 0.9);
}

.foundation strong {
  display: block;
  color: var(--accent);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 3.2rem;
  line-height: 1;
}

.foundation span {
  display: block;
  margin: 14px 0 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.foundation p,
.story-card p,
label,
footer {
  color: var(--muted);
  line-height: 1.7;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
}

.home-story-strip {
  width: 100%;
  margin-top: 0;
  text-align: left;
}

@media (min-width: 821px) {
  .home-hero-grid.story-on-left .home-primary {
    transform: translateX(clamp(160px, 18vw, 260px));
  }

  .home-hero-grid.story-on-right .home-primary {
    transform: translateX(clamp(-140px, -10vw, -90px));
  }

  .home-story-strip {
    position: absolute;
    z-index: 2;
    width: min(285px, 24vw);
  }

  .story-pos-upper-right {
    top: 7%;
    right: 0;
  }

  .story-pos-middle-right {
    top: 42%;
    right: 0;
    transform: translateY(-50%);
  }

  .story-pos-lower-right {
    right: 0;
    bottom: 13%;
  }

  .story-pos-upper-left {
    top: 7%;
    left: 0;
  }

  .story-pos-middle-left {
    top: 42%;
    left: 0;
    transform: translateY(-50%);
  }

  .story-pos-lower-left {
    bottom: 13%;
    left: 0;
  }
}

.story-teasers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.home-actions a,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #100d08;
  font: 800 0.82rem/1 Inter, Arial, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0;
}

.mini-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.mini-logo-fallback {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 700;
}

.site-header nav {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.site-header a[aria-current="page"] {
  color: var(--accent-soft);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.story-hero {
  padding: 74px 0 54px;
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 42px;
  align-items: start;
  padding-bottom: 80px;
}

.story-form,
.story-card,
.resource-card {
  border: 1px solid var(--line);
  background: rgba(17, 17, 17, 0.88);
}

.story-form {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 18px;
  padding: 28px;
}

.form-heading h2,
.feed-heading h2 {
  margin-bottom: 10px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.9rem;
}

.form-heading p {
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #393731;
  border-radius: 0;
  background: #090909;
  color: var(--text);
  font: 1rem/1.5 Inter, Arial, sans-serif;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 190px;
  padding: 14px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(255, 90, 18, 0.68);
  outline-offset: 2px;
}

.story-feed {
  display: grid;
  gap: 22px;
}

.resource-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 42px;
  align-items: start;
  padding-bottom: 80px;
}

.resource-copy h2,
.admin-section-heading h2 {
  margin-bottom: 14px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 2rem;
}

.resource-copy p {
  color: var(--muted);
  line-height: 1.75;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.is-hidden,
.trap-field {
  display: none !important;
}

.form-status,
.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-status[data-type="success"] {
  color: #ffd7b7;
}

.form-status[data-type="error"] {
  color: #ff9d7c;
}

.story-card {
  padding: 28px;
}

.resource-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 24px;
}

.story-card h3,
.resource-card h3 {
  margin-bottom: 14px;
  color: var(--accent-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.7rem;
}

.resource-card h3 {
  margin-bottom: 0;
  font-size: 1.42rem;
}

.resource-card p {
  color: var(--muted);
  line-height: 1.65;
}

.resource-card a {
  justify-self: start;
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.story-card p:last-child {
  margin-bottom: 0;
}

.story-card-compact {
  padding: 16px;
}

.story-card-compact h3 {
  font-size: 1.08rem;
}

.story-card-compact p:last-child {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.story-date {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-hero {
  padding-bottom: 34px;
}

.admin-panel {
  padding-bottom: 80px;
}

.token-form {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.logout-button {
  min-height: 40px;
  margin-bottom: 16px;
  border-color: #4a4039;
  background: transparent;
  color: var(--accent-soft);
}

.admin-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.notification-log {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 17, 0.72);
}

.notification-log h2 {
  margin: 0;
  color: var(--accent-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
}

.notification-row {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-group {
  display: grid;
  gap: 16px;
  align-content: start;
}

.admin-group h2 {
  margin: 0;
  color: var(--accent-soft);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.45rem;
  text-transform: capitalize;
}

.admin-card {
  padding: 22px;
}

.admin-card h3 {
  font-size: 1.35rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.admin-actions button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.72rem;
}

.admin-actions button[data-action="deny"] {
  background: transparent;
  color: var(--accent-soft);
}

.admin-actions button[data-action="delete"] {
  border-color: #8f2c11;
  background: #8f2c11;
  color: #fff2df;
}

.downloads-admin-panel {
  padding-top: 10px;
}

.smtp-admin-panel {
  padding-top: 10px;
}

.download-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.download-form label:nth-child(3) {
  grid-column: span 2;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-label input {
  width: 18px;
  height: 18px;
}

input[type="file"] {
  min-height: 46px;
  padding: 10px 12px;
}

.admin-download-list {
  margin-top: 24px;
}

.admin-download-card button {
  justify-self: start;
  min-height: 38px;
  padding: 0 12px;
  border-color: #8f2c11;
  background: #8f2c11;
  color: #fff2df;
  font-size: 0.72rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

@media (max-width: 820px) {
  .home-shell {
    min-height: auto;
  }

  .foundation,
  .home-hero-grid,
  .story-layout,
  .story-teasers,
  .resource-layout,
  .resource-list,
  .admin-columns,
  .token-form,
  .download-form {
    grid-template-columns: 1fr;
  }

  .download-form label:nth-child(3) {
    grid-column: auto;
  }

  .foundation article {
    min-height: auto;
  }

  .story-form {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: 2.55rem;
  }

  .story-hero {
    padding-top: 48px;
  }
}
