/* ============================================================
   42 POTENTIAL — hand-drawn retro stylesheet
   Accent color is themeable: click the swatch in the menu bar.
   ============================================================ */

:root {
  color-scheme: only light; /* stop mobile browsers from force-darkening */

  --paper: #fffdf8;
  --paper-deep: #fdfaf4;
  --ink: #111;
  --ink-border: #222;

  /* accent */
  --accent: #cb010d;
  --accent-dark: #6b0107;
  --accent-soft: rgba(203, 1, 13, 0.1);
  --accent-tint: rgba(203, 1, 13, 0.3);
  --accent-checked: #ffe0e0;
}





body {
  background: #e8e8e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  margin: 0;
  padding: 1rem;
  box-sizing: border-box;
}

/* Main content fills the space under the menu bar */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 68rem);
  margin-top: 1rem;
  min-height: 0;
}

/* ===== Menu bar: a logo square + a nav rectangle, cut apart ===== */
.menu-bar {
  width: min(100%, 68rem);
  display: flex;
  align-items: stretch;
  gap: 0.9rem;
  flex-shrink: 0;
  font-family: "VT323", "Courier New", monospace;
}

.menu-card {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.5rem;
  box-shadow: 4px 4px 0 #000;
  position: relative;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .menu-card:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 0 #000;
  }
}

/* Paper texture on both pieces */
.menu-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.4rem;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 2px
  );
  pointer-events: none;
  opacity: 0.25;
}

/* The square: logo box on the left (links home) */
.logo-box {
  width: 5rem;
  height: 5rem;
  flex-shrink: 0;
}

.logo-link {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  display: block;
}

/* The rectangle: nav with the buttons, "cut" from the square */
.menu-box {
  flex: 1;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 1rem;
  box-sizing: border-box;
}

.menu-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--ink);
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border-radius: 0.3rem;
  position: relative;
  z-index: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* the page you're currently on */
.menu-btn.current {
  color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .menu-btn:hover {
    background-color: var(--accent-soft);
    color: var(--accent);
    animation: jitter 0.3s infinite alternate;
  }
}

.menu-btn:active {
  transform: translate(2px, 2px);
}

@keyframes jitter {
  from { transform: rotate(-1deg) translateX(-1px); }
  to   { transform: rotate(1deg) translateX(1px); }
}

/* signed in / signed out indicator on the Account button */
.status-dot {
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper-deep);
  box-shadow:
    inset -1px -1px 0 rgba(0, 0, 0, 0.35),
    1px 1px 0 #000;
  transition: background-color 0.2s ease;
}

.status-dot.on {
  background: var(--accent);
  border-color: var(--accent-dark);
  animation: dot-bounce 0.4s ease-out;
}

@keyframes dot-bounce {
  0%   { transform: scale(0.3); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ===== Main Card (fills the screen; everything lives in here) ===== */
.title-card {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.5rem;
  padding: 2.5rem 3rem;
  width: 100%;
  flex: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 4px 4px 0 #000;
}

/* Paper texture effect */
.title-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 2px
  );
  pointer-events: none;
  opacity: 0.25;
}

/* Retro scanline effect */
.title-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 3px
  );
  pointer-events: none;
  animation: scanline 2s linear infinite;
}

@keyframes scanline {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* ===== TV static on the matte white background ===== */
.static {
  position: absolute;
  inset: 0;
  border-radius: 0.4rem;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  animation: static-flicker 0.4s steps(4) infinite;
}

@keyframes static-flicker {
  0%   { background-position: 0 0; }
  25%  { background-position: -60px 40px; }
  50%  { background-position: 40px -60px; }
  75%  { background-position: -40px -40px; }
  100% { background-position: 60px 60px; }
}

/* ===== The typed title ===== */
.title-text {
  font-family: "VT323", "Courier New", monospace;
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-shadow: 2px 2px 0 var(--accent-tint);
  min-height: 1.2em;
  display: flex;
  align-items: center;
  margin: 0;
  position: relative;
  z-index: 1;
}

.title-text.final {
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--accent-dark);
}

/* ===== Blinking cursor ===== */
.cursor {
  display: inline-block;
  width: 0.45ch;
  height: 0.7em;
  margin-left: 0.1ch;
  align-self: center;
  background: currentColor;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.cursor.typing {
  animation: none;
  opacity: 1;
}

/* ===== Account page: auth forms ===== */
.auth-wrap {
  width: min(100%, 24rem);
  margin-top: 2rem;
  position: relative;
  z-index: 1;
  font-family: "VT323", "Courier New", monospace;
}

.auth-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.auth-tab {
  flex: 1;
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* checked-radio look, straight from the original radio group */
.auth-tab.active {
  background: var(--accent-checked);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow:
    inset -2px -2px 0 var(--accent),
    3px 3px 0 #000;
}

.auth-tab:active,
.auth-submit:active,
.peek:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field > span {
  font-size: 1.05rem;
  color: var(--ink);
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.field input {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.12);
  font-family: inherit;
  font-size: 1.2rem;
  color: var(--ink);
  padding: 0.45rem 0.6rem;
  outline: none;
}

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

/* show/hide password */
.peek {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  padding: 0 0.6rem;
  cursor: pointer;
}

.peek.peeking {
  background: var(--accent-checked);
  color: var(--accent);
  border-color: var(--accent);
}

/* password requirements: little radio dots that pop when satisfied */
.req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.req {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.02rem;
  color: var(--ink);
  transition: color 0.2s ease;
}

.req-visual {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper-deep);
  box-shadow:
    inset -1px -1px 0 var(--ink),
    1px 1px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.req-dot {
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.2s ease-out;
  box-shadow: inset 1px 1px 0 var(--accent-dark);
}

.req.ok {
  color: var(--accent);
}

.req.ok .req-dot {
  transform: scale(1);
  animation: bounce 0.4s ease-out;
}

.req.ok .req-visual {
  background: var(--accent-checked);
  border-color: var(--accent);
}

@keyframes bounce {
  0%   { transform: scale(0.3); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.auth-submit {
  background: var(--accent);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-size: 1.25rem;
  color: var(--paper);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  margin-top: 0.3rem;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-error {
  color: var(--accent);
  font-size: 1.05rem;
  margin: 0;
}

.auth-hello {
  font-size: 1.4rem;
  color: var(--ink);
  margin: 0 0 0.2rem;
}

.auth-name {
  color: var(--accent);
}

.auth-email {
  font-size: 1.05rem;
  color: #555;
  margin: 0 0 1rem;
}


/* ===== shipping address (signed-in panel) ===== */
.addr-section {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 2px dashed var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: left;
}

.addr-title {
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0;
}

.autocomplete {
  position: relative;
}

.suggest {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 4px 4px 0 #000;
  max-height: 13rem;
  overflow-y: auto;
}

.suggest li {
  padding: 0.45rem 0.6rem;
  font-size: 1.05rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
}

.suggest li:last-child {
  border-bottom: none;
}

.suggest li:hover,
.suggest li.hl {
  background: var(--accent-soft);
  color: var(--accent);
}

.addr-row {
  display: flex;
  gap: 0.6rem;
}

.addr-row .field {
  flex: 1;
  min-width: 0;
}

.addr-saved {
  color: var(--accent);
  font-size: 1.05rem;
  margin: 0;
  animation: bounce 0.4s ease-out;
}

/* ===== Mobile: compact touch layout, no hover behavior ===== */
@media (max-width: 640px) {
  body {
    padding: 0.6rem;
  }

  .menu-bar {
    gap: 0.6rem;
  }

  .logo-box {
    width: 3.6rem;
    height: 3.6rem;
  }

  .menu-box {
    height: 3.6rem;
    padding: 0 0.4rem;
  }

  .menu-btn {
    font-size: 1.05rem;
    padding: 0.15rem 0.35rem;
    gap: 0.3rem;
  }

  .stage {
    margin-top: 0.6rem;
  }

  .title-card {
    padding: 1.4rem 1rem;
  }

  .title-text {
    font-size: clamp(1.5rem, 8.5vw, 2.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-card::before { animation: none; }
  .static { animation: none; }
  .menu-btn:hover { animation: none; }
}

/* ===== Admin link in nav (accent-tinted so it stands out) ===== */
.admin-link {
  color: var(--accent);
  font-weight: 400;
}

/* ===== Admin page ===== */
.admin-locked {
  margin-top: 2rem;
  text-align: center;
  font-family: "VT323", "Courier New", monospace;
  font-size: 1.3rem;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.admin-wrap {
  width: min(100%, 60rem);
  margin-top: 1.6rem;
  position: relative;
  z-index: 1;
  font-family: "VT323", "Courier New", monospace;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-search {
  flex: 1;
  min-width: 12rem;
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.12);
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  padding: 0.4rem 0.6rem;
  outline: none;
}

.admin-search:focus { border-color: var(--accent); }

.admin-downloads {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 1.05rem;
  color: var(--ink);
}

.dl-label { color: #555; margin-left: 0.3rem; }

.quick {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 3px 3px 0 #000;
  font-family: inherit;
  font-size: 1.02rem;
  color: var(--ink);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.quick:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }

.result-box {
  overflow-x: auto;
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.4rem;
  box-shadow: 4px 4px 0 #000;
  padding: 0.6rem;
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 1.05rem;
}

.admin-table th, .admin-table td {
  border: 1px dashed rgba(0, 0, 0, 0.3);
  padding: 0.3rem 0.55rem;
  text-align: left;
  color: var(--ink);
  white-space: nowrap;
}

.admin-table th {
  color: var(--accent);
  border-bottom: 2px solid var(--ink);
}

.row-btn {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.3rem;
  box-shadow: 2px 2px 0 #000;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  padding: 0.1rem 0.5rem;
  margin-right: 0.35rem;
  cursor: pointer;
}

.row-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #000; }
.row-btn.danger { color: var(--accent); border-color: var(--accent); }
.row-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.meta-line { color: #555; font-size: 1rem; margin: 0; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

/* the hidden attribute must win over display:flex */
.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--paper);
  border: 2px solid var(--ink-border);
  border-radius: 0.5rem;
  box-shadow: 6px 6px 0 #000;
  font-family: "VT323", "Courier New", monospace;
  width: min(100%, 26rem);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
}

.admin-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

@media (max-width: 640px) {
  .admin-table { font-size: 0.95rem; }
}
