/* AA Comics – colours taken from the original WordPress theme settings. */
:root {
  --ink: #1a1a1a;          /* main text */
  --muted: #5c5c5c;        /* secondary text */
  --line: rgba(0, 0, 0, 0.12);
  --accent: #d95a00;       /* links, prices, current page (original #ff6600, darkened for legibility) */
  --amber: #dd9933;        /* nav, "for sale" band */
  --amber-text: #9a5a08;   /* amber dark enough to read on white */
  --bg: #dd8d13;           /* shows while the background photo loads */
  --card: rgba(255, 255, 255, 0.9);   /* see-through panels over the photo */
  --black: #000;
  --radius: 8px;
  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font: 17px/1.65 var(--font);
  color: var(--ink);
  /* The comics photo scrolls with the page (as on the original site). A fixed
     background jumps on phones when the address bar slides in and out. */
  background: var(--bg) url("images/background.jpg") center top / cover no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: #a84400; }

img { max-width: 100%; }

/* ---------- header ---------- */

.site-header {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.banner {
  display: block;
  max-width: 900px;
  margin: 0 auto;
  line-height: 0;
}

.banner img {
  width: 100%;
  height: auto;
}

.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 32px;
  padding: 10px 16px;
  border-top: 1px solid #eee;
  border-bottom: 4px solid var(--amber);
}

.site-nav a {
  color: var(--amber-text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-size: 15px;
  padding: 4px 0;
  border-bottom: 3px solid transparent;
}

.site-nav a:hover { color: var(--accent); }

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

/* ---------- page layout: sidebar on the left, like the original ---------- */

.layout {
  width: 100%;
  max-width: 1140px;
  margin: 28px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  grid-template-areas: "side main";
  gap: 24px;
  align-items: start;
  flex: 1 0 auto;
}

.layout.single { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; max-width: 800px; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.main { grid-area: main; padding: 28px 32px 32px; }
.findus { grid-area: side; padding: 24px; }

h1 {
  margin: 0 0 20px;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
}

.articles { display: flex; flex-direction: column; gap: 28px; }

article h2 { margin: 0 0 8px; font-size: 23px; line-height: 1.3; }
article p { margin: 0 0 0.8em; }
article p:last-child { margin-bottom: 0; }

.articles > article + article {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.images.end { margin: 16px 0 0; }

.images img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.empty { color: var(--muted); }
.note { color: var(--muted); font-size: 15px; margin: 24px 0 0; }

/* Section headings in the style of the original widgets: uppercase with a short bar under them. */
.widget-title {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.widget-title::after {
  content: "";
  display: block;
  width: 70px;
  height: 3px;
  margin-top: 8px;
  background: currentColor;
  opacity: 0.35;
}

/* ---------- Find us sidebar ---------- */

.findus article + article { margin-top: 18px; }
.findus h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 900;
}
.findus p { margin: 0; font-size: 15px; line-height: 1.55; }
.findus a { font-weight: 700; word-break: break-word; }

/* ---------- for-sale cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover,
.card:focus-visible {
  color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.card-img {
  aspect-ratio: 3 / 4;
  background: #eee;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
}

.card-title {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  font-weight: 900;
  color: var(--accent);
}

/* ---------- "Items for sale now" band on the home page ---------- */

.strip {
  background: var(--amber);
  padding: 32px 16px 36px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.strip-inner { max-width: 1108px; margin: 0 auto; }
.strip .widget-title { color: #fff; }
.strip .widget-title::after { opacity: 0.8; }
.strip .empty { color: #fff; }

.strip-more { margin: 24px 0 0; text-align: center; }

.button {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 4px;
  background: var(--black);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.button:hover { background: #333; color: #fff; }

/* ---------- footer ---------- */

.site-footer {
  background: var(--black);
  color: #bbb;
  text-align: center;
  font-size: 14px;
  padding: 20px 16px;
}

.site-footer p { margin: 2px 0; }

/* ---------- phones and small tablets ---------- */

@media (max-width: 820px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "side";
    margin: 16px auto;
    gap: 16px;
  }
  .main { padding: 22px 20px 24px; }
  h1 { font-size: 28px; }
  .site-nav { gap: 4px 24px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
}

/* =========================================================
   Item viewer (item.html)
   ========================================================= */

.viewer-page {
  background: #111;
  color: #eee;
  min-height: 100vh;
}

.viewer-page a { color: #ffb366; }

.viewer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 12px 0 20px;
  background: #000;
  flex: none;
}

.viewer-page .viewer-brand {
  color: var(--amber);
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.viewer-count { color: #999; font-size: 14px; flex: 1; }

.viewer-page .viewer-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  text-decoration: none;
}

.viewer-page .viewer-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* Desktop: [prev] [photo] [next] [details] */
.viewer-main {
  flex: none;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 110px 340px;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "prev stage next info";
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 52px);
  min-height: 420px;
}

.viewer-stage {
  grid-area: stage;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  border-radius: 6px;
  min-height: 0;
}

.viewer-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 52px - 24px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer-stage.can-zoom img { cursor: zoom-in; }

/* Zoomed: photo at actual size, scrollable / draggable. */
.viewer-stage.zoomed {
  display: block;
  overflow: auto;
}

.viewer-stage.zoomed img {
  max-width: none;
  max-height: none;
  cursor: grab;
}

.viewer-stage.zoomed img:active { cursor: grabbing; }

.viewer-stage.loading::after {
  content: "Loading full-size photo…";
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #ddd;
  font-size: 13px;
  pointer-events: none;
}

.viewer-stage.missing::after {
  content: "No photo";
  color: #777;
}

.viewer-nav {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.viewer-nav[hidden] { display: none; }
.viewer-nav.prev { grid-area: prev; }
.viewer-nav.next { grid-area: next; }

.nav-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: #222;
  opacity: 0.65;
  outline: 2px solid transparent;
  transition: opacity 0.15s, outline-color 0.15s;
}

.nav-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.viewer-nav:hover .nav-thumb,
.viewer-nav:focus-visible .nav-thumb { opacity: 1; outline-color: var(--amber); }

.viewer-page .nav-label { color: #ccc; font-size: 14px; }
.viewer-nav.prev .nav-label::before { content: "‹ "; }
.viewer-nav.next .nav-label::after { content: " ›"; }

.viewer-info {
  grid-area: info;
  overflow-y: auto;
  padding: 8px 8px 8px 12px;
}

.viewer-info h1 { color: #fff; font-size: 26px; margin: 0 0 8px; }
.viewer-info .price { color: #ffb366; font-size: 24px; margin: 0; }
.viewer-info .price:empty { display: none; }
.viewer-info time { display: block; color: #999; font-size: 14px; margin: 4px 0 16px; }
.viewer-info #articles p { margin: 0 0 0.8em; }
.viewer-help { color: #777; font-size: 13px; margin-top: 24px; }
.help-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .help-mouse { display: none; }
  .help-touch { display: inline; }
}

.viewer-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.viewer-photos[hidden] { display: none; }

.viewer-photos button {
  width: 64px;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: #222;
  cursor: pointer;
}

.viewer-photos button.active { border-color: var(--amber); }
.viewer-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Narrower screens: photo on top, prev/next under it, details below. */
@media (max-width: 1000px) {
  .viewer-main {
    height: auto;
    grid-template-rows: auto;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "stage stage"
      "prev  next"
      "info  info";
    padding: 8px;
  }
  .viewer-stage { height: calc(100svh - 52px - 170px); min-height: 300px; }
  .viewer-stage img { max-height: 100%; }
  .viewer-nav { flex-direction: row; align-self: stretch; gap: 10px; }
  .viewer-nav.prev { justify-self: start; }
  .viewer-nav.next { justify-self: end; flex-direction: row-reverse; }
  .nav-thumb { width: 54px; flex: none; }
  .viewer-info { padding: 8px 6px 32px; overflow: visible; }
}
