/* ==========================================================
   amusing.mom — layout fixes (Nov 2026)
   Loaded LAST on every page so it overrides older CSS.
   Sections: 1. Header + logo  2. Nav  3. Scattered grid  4. Pop-ups
   ========================================================== */

/* Logo font, bundled with the site so it always loads (SIL Open Font License, see fonts/) */
@font-face {
  font-family: 'Sniglet';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/sniglet-400.woff2') format('woff2');
}

/* ---------- 1. HEADER + LOGO (index.html) ---------- */
body.am-shell { margin: 0; background: #fff; }
/* custom.css sets body{overflow:hidden}, which silently disables position:sticky.
   On the main page the body doesn't need to clip anything, so let it be. */
body.am-shell { overflow: visible !important; }

header.am-header {
  background: #F0544F;
  padding: 18px 12px 0;
  line-height: 1.2;
  text-align: center;
}

.am-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  font-family: 'Sniglet', 'Fredoka', sans-serif;   /* logo font: Sniglet (option J) */
  font-weight: 400;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap;
}
.am-logo:hover { color: #fff; }
.am-logo-icon {
  width: 1.15em;
  height: 1.15em;
  max-width: none !important;  /* custom.css shrinks all imgs on mobile; not these */
  object-fit: contain;
  flex: none;
}

.am-tagline {
  margin: 6px 0 0 !important;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 15px !important;
  color: #fff !important;
  letter-spacing: 0.2em;
}

/* The gallery frame: height is set by script so the whole page grows with it */
#myiframe { display: block; width: 100%; height: 100vh; border: 0; }

/* ---------- 2. NAV ---------- */
/* Category pages keep their own nav for visitors who land on them directly,
   but hide it when they're showing inside index.html (which has the nav). */
html.am-framed .am-nav { display: none !important; }

.am-nav {
  background: #F0544F;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px 18px;
}

.am-door {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 104px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fff !important;
  text-decoration: none !important;
  transition: background-color .15s;
}
.am-door span {          /* all.html has a global span{color:#666;display:flex} rule */
  color: inherit !important;
  display: inline !important;
  padding: 0 !important;
}
.am-door img { width: 44px; height: 44px; max-width: none !important; }
.am-door:hover,
.am-door:focus-visible { background: #E0403B; color: #fff; }
.am-door.is-active { background: #CB1812; box-shadow: 0 0 0 1px rgb(153,17,13); }

/* PHONES: logo on the left, nav on the right, one slim row that stays on screen */
@media (max-width: 600px) {
  /* Fixed (not sticky): works in every phone browser, including iPhone Safari,
     and can't be switched off by old overflow rules. The page is pushed down by
     the header's height so nothing hides underneath it (set in index.html). */
  header.am-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    box-shadow: 0 1px 0 rgb(153,17,13);
  }
  .am-brand { flex: none; }
  .am-logo { font-size: 19px; gap: 4px; text-align: left; }
  .am-logo-text span { display: block; }      /* "amusing" over "mom" */
  .am-logo-icon { width: 30px; height: 30px; }
  .am-logo-icon-right, .am-tagline { display: none; }

  .am-nav-main {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 2px;
    padding: 0;
  }
  .am-nav-main .am-door {
    min-width: 0;
    width: 38px;
    padding: 4px 0 3px;
    gap: 2px;
    border-radius: 8px;
    font-size: 8.5px;
    letter-spacing: 0;
  }
  .am-nav-main .am-door img { width: 24px; height: 24px; }

  /* nav on a category page opened directly (not inside index.html) */
  .am-nav:not(.am-nav-main) {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px;
  }
  .am-nav:not(.am-nav-main) .am-door { min-width: 0; padding: 8px 4px 7px; font-size: 13px; gap: 4px; }
  .am-nav:not(.am-nav-main) .am-door img { width: 30px; height: 30px; }
}
@media (max-width: 600px) {
  body.am-shell { padding-top: var(--am-header-h, 56px); }
}
@media (max-width: 350px) {
  .am-nav-main .am-door { width: 32px; }
  .am-nav-main .am-door span { display: none !important; }   /* tiny phones: icons only */
}

/* ---------- FOOTER (index.html) ---------- */
.am-footer {
  background: #fff;
  border: 0;
  padding: 0 12px 26px;
  text-align: center;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
}
.am-footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; }
.am-footer-links a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 500; color: #888 !important; text-decoration: none !important;
}
.am-footer-links a:hover { color: #555 !important; text-decoration: underline !important; }
.am-studio-link { display: inline-block; line-height: 0; }
.am-studio-logo { width: 180px; height: auto; display: block; margin: 0 auto; }
.am-credits { margin-top: 10px; font-size: 13px; color: #888; text-align: center; }
.am-credits a { color: #888 !important; text-decoration: none !important; }
@media (max-width: 600px) {
  .am-studio-logo { width: 150px; }
}

/* ---------- 3. SCATTERED PRODUCT GRID ---------- */
/* Tablet + desktop positions come from js/amusing-scatter.js.
   Works for all.html (<button class="button">) and category pages (<div class="column">). */
.cardGroup {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px 60px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}
.cardGroup.am-scatter { display: block; position: relative; padding: 0; }
.cardGroup.am-scatter > button.button,
.cardGroup.am-scatter > .column {
  position: absolute;
  margin: 0 !important;
  transform: none !important;
}

.cardGroup > button.button,
.cardGroup > .column {
  display: block;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0 !important;           /* no more line under each haiku */
  outline: none;
}
.cardGroup > button.button:hover { border: 0 !important; }

/* tighten the empty space inside each product */
.cardGroup .column { min-width: 0; padding: 4px; }
.cardGroup .card,
.cardGroup .card.group,
.cardGroup .card.image { padding: 4px 0 !important; margin: 0 !important; border: 0 !important; }
.cardGroup br.am-extra-br { display: none; }   /* set by amusing-scatter.js: trims long runs of blank lines */
.cardGroup img { max-width: 100%; height: auto; }

/* Phone: one column that zig-zags left and right */
@media (max-width: 600px) {
  .cardGroup > button.button, .cardGroup > .column { width: 80%; margin: 0 0 22px; }
  .cardGroup > button.button:nth-of-type(odd),  .cardGroup > .column:nth-of-type(odd)  { margin-right: auto; margin-left: 2%; }
  .cardGroup > button.button:nth-of-type(even), .cardGroup > .column:nth-of-type(even) { margin-left: auto; margin-right: 2%; }
  .cardGroup > button.button:nth-of-type(3n),   .cardGroup > .column:nth-of-type(3n)   { width: 70%; margin-left: 15%; margin-right: 15%; }
}

/* ---------- 4. POP-UPS ---------- */
.modal-content {
  width: 92% !important;
  max-width: 640px;
}
.modal-content img {
  max-width: 100% !important;
  height: auto;
  display: block;
}

/* blank lines at the top of each gallery page: not needed inside index.html */
html.am-framed body > br { display: none; }
html.am-framed .cardGroup { margin-top: 24px; }

/* ---------- 5. PRODUCT CARDS: same rounded font as the logo ---------- */
/* Fredoka for English; M PLUS Rounded 1c fills in the Japanese (Fredoka has no kana). */
.cardGroup .column,
.am-pop {
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  text-align: center;
  color: #222;
}
.cardGroup .column { padding: 6px 4px 10px; }
.am-photo { display: block; margin: 0 auto; max-width: 100% !important; width: auto; height: auto !important; }
.cardGroup .column { min-width: 0 !important; }
/* Type: two sizes, two colours. Bold dark title; everything else one size in soft grey. */
.am-title {
  font-weight: 700;
  font-size: 21px;
  line-height: 1.3;
  margin: 12px 0 18px;   /* a little air before the haiku */
  color: #2b2b2b;
}
.am-title small {
  display: block;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #777;
  margin-top: 2px;
}
.am-haiku {
  font-weight: 500;
  font-size: 15px;
  line-height: 1.6;
  color: #777;
}
.am-haiku[lang="ja"] { letter-spacing: 0.06em; margin-bottom: 10px; }

.am-pop { padding: 10px 6px 18px; }
.am-pop img { margin: 0 auto 10px; }
.am-pop .close { position: absolute; right: 14px; top: 8px; font-size: 32px; color: #999; cursor: pointer; }
.modal-content { position: relative; border-radius: 14px; }
.modal .contact-form.am-pop { background: #fff; box-shadow: none; margin: 0; }

@media (max-width: 600px) {
  .am-title { font-size: 19px; }
}

/* ---------- BACK-TO-TOP ARROW (index.html) ---------- */
.am-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #F0544F;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s, background-color .15s;
}
.am-to-top.is-shown { opacity: .92; visibility: visible; transform: none; }
.am-to-top:hover { background: #CB1812; opacity: 1; }
.am-to-top:focus-visible { outline: 2px solid #CB1812; outline-offset: 3px; }
@media (max-width: 600px) {
  .am-to-top { right: 12px; bottom: 14px; width: 42px; height: 42px; }
}

/* ---------- HAIKU PAGE (haiku.html) ---------- */
body.am-haiku-page { margin: 0; background: #fff; }
.am-poems {
  max-width: 1100px;
  margin: 0 auto;
  padding: 34px 20px 70px;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  color: #2b2b2b;
  text-align: center;
}
.am-poems-intro h1 { font-size: 30px; font-weight: 700; margin: 0 0 6px; }
.am-poems-intro h1 small,
.am-poem-head small { display: block; font-size: 15px; font-weight: 500; color: #777; letter-spacing: .03em; margin-top: 2px; }
.am-poems-intro p { font-size: 15px; color: #777; margin: 8px auto 0; max-width: 520px; line-height: 1.6; }

.am-poem-section { margin-top: 56px; }
.am-poem-head { font-size: 23px; font-weight: 700; margin: 0 0 26px; }

/* poems flow down in loose columns, like a page of a notebook */
.am-poem-grid { columns: 3 280px; column-gap: 44px; }
.am-poem-card { break-inside: avoid; padding: 0 0 38px; }

.am-poem-ja {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.6;
  letter-spacing: .06em;
  margin: 0 0 10px;
  color: #2b2b2b;
}
.am-poem-en { font-size: 15px; line-height: 1.6; color: #777; margin: 0; }
.am-poem-note { font-size: 13px; color: #999; margin: 8px 0 0; font-style: italic; }

/* earlier drafts of the same poem: smaller, quieter */
.am-poem-alt { margin-top: 16px; }
.am-poem-alt .am-poem-ja { font-size: 16px; font-weight: 500; color: #555; margin-bottom: 6px; }
.am-poem-alt .am-poem-en { font-size: 14px; color: #999; }
.am-poem-label { font-size: 12px; color: #aaa; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }

@media (max-width: 600px) {
  .am-poems { padding: 24px 16px 50px; }
  .am-poem-section { margin-top: 40px; }
  .am-poem-ja { font-size: 17px; }
}

/* seven nav buttons on phones: a little narrower so they still fit beside the logo */
@media (max-width: 600px) {
  .am-nav-main .am-door { width: 34px; }
  .am-nav-main { gap: 1px; }
  .am-logo-icon { width: 26px; height: 26px; }
  .am-logo { font-size: 18px; }
}
@media (max-width: 380px) {
  .am-nav-main .am-door { width: 31px; }
  .am-nav-main .am-door span { font-size: 7.5px; }
}
@media (max-width: 350px) {
  .am-nav-main .am-door span { display: none !important; }
}
