:root {
  --paper: #fff8df;
  --surface: #ffffff;
  --ink: #151515;
  --muted: #5f6258;
  --line: #151515;
  --yellow: #ffd84d;
  --blue: #59b6ff;
  --pink: #ff7aa8;
  --green: #68d391;
  --shadow: 8px 8px 0 #151515;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 21, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  color: var(--ink);
  font-family:
    ui-rounded,
    "Avenir Next",
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 3px solid var(--line);
  background: var(--surface);
}

.brand-link,
.site-nav a,
.primary-button,
.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.brand-link {
  padding: 0.75rem 0.95rem;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--line);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-nav a,
.project-link {
  padding: 0.72rem 0.9rem;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--line);
}

.brand-link:hover,
.site-nav a:hover,
.primary-button:hover,
.project-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--line);
}

.brand-link:active,
.site-nav a:active,
.primary-button:active,
.project-link:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--line);
}

.page-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) 0 4rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.project-card,
.state-panel,
.upload-form {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.project-cover,
.project-initial {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-bottom: 3px solid var(--line);
  background: var(--pink);
}

.project-cover {
  display: block;
  object-fit: cover;
}

.project-initial {
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: clamp(3rem, 11vw, 5rem);
  font-weight: 1000;
}

.project-card:nth-child(3n + 2) .project-initial {
  background: var(--blue);
}

.project-card:nth-child(3n + 3) .project-initial {
  background: var(--green);
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
}

.project-body h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.project-body p {
  margin: 0;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.tag {
  max-width: 100%;
  padding: 0.22rem 0.48rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.project-link {
  width: fit-content;
  margin-top: 0.25rem;
  background: var(--ink);
  color: var(--surface);
}

.state-panel {
  grid-column: 1 / -1;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.state-panel h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.state-panel p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
}

.runner-shell {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) 0 2rem;
}

.runner-shell h1 {
  max-width: none;
  margin-bottom: 1rem;
  font-size: clamp(1.8rem, 5vw, 3.7rem);
  overflow-wrap: anywhere;
}

.runner-error {
  margin-top: 1rem;
}

.project-frame {
  display: block;
  width: 100%;
  min-height: min(72vh, 780px);
  height: 72vh;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-shell {
  max-width: 860px;
}

.upload-form {
  display: grid;
  gap: 1.1rem;
  margin-top: 2rem;
  padding: clamp(1rem, 4vw, 1.6rem);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field-block {
  display: grid;
  gap: 0.45rem;
}

label {
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #fffef8;
  color: var(--ink);
  padding: 0.72rem 0.8rem;
}

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

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}

input[type="file"] {
  padding: 0.55rem;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-button {
  width: fit-content;
  min-width: 180px;
  padding: 0.85rem 1.05rem;
  background: var(--pink);
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--line);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.form-status {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.form-status.error {
  color: #a30024;
}

.form-status.success {
  color: #176b35;
}

@media (max-width: 680px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
    gap: 0.75rem;
  }

  .brand-link,
  .site-nav a,
  .primary-button,
  .project-link {
    width: 100%;
  }

  .site-nav {
    width: 100%;
  }

  h1 {
    font-size: clamp(2.1rem, 13vw, 3.5rem);
  }

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

  .project-frame {
    min-height: 68vh;
    height: 68vh;
  }

  .project-card,
  .state-panel,
  .upload-form,
  .project-frame {
    box-shadow: 5px 5px 0 var(--line);
  }
}
