/* ============================================================================
   MasayaCo Stories — stories.masayaco.com
   Type, colour and layout are lifted from the live Shopify theme so this site
   reads as the same brand. Font files are the theme's own webfonts, served
   from Shopify's CDN (Access-Control-Allow-Origin: *) — no new licences, no
   drift. To self-host instead, run `npm run vendor:pdfjs`-style copies into
   /fonts and swap the two src: lines below.
   ========================================================================= */

@font-face {
  font-family: "Circular Regular";
  src: url("https://cdn.shopify.com/s/files/1/1026/2987/files/CircularXXWeb-Regular.woff2?v=1662551540") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Circular Medium";
  src: url("https://cdn.shopify.com/s/files/1/1026/2987/files/CircularXXWeb-Medium.woff2?v=1662551540") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Coconat";
  src: url("https://www.masayaco.com/cdn/shop/files/Coconat-Regular.woff2?v=1754575507") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* Pulled from the storefront theme's :root custom properties. */
  --bg-body: #ffffff;
  --color-accent: #000000;
  --color-accent3: #eef3ee;
  --color-border: #e9e9e9;
  --color-header-border: #e3e3e3;
  --color-announcement-bg: #000000;
  --color-announcement-text: #ffffff;
  --color-footer-bar-bg: #f5f5f5;
  --color-footer-bar-text: #111111;
  --color-muted: #6b6b6b;
  --color-link-hover: #939393;
  --button-border-radius: 5px;

  --font-body: "Circular Regular", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-medium: "Circular Medium", var(--font-body);
  --font-display: "Coconat", Georgia, "Times New Roman", serif;

  --text-body: 17px;
  --leading-body: 1.75;
  --gutter: 100px;
  --gutter-sm: 20px;
  --header-h: 70px;
  --announcement-h: 38px;
  --section-gap: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-body);
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-link-hover); }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: #000; color: #fff; padding: 12px 20px;
}
.skip-link:focus { left: 0; color: #fff; }

/* ------------------------------------------------------------- structure */

.gutter, .site-header__inner, .page-header__inner, .site-footer__inner,
.site-footer__bar-inner, main > section {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* --------------------------------------------------- announcement bar */

.announcement-bar {
  background: var(--color-announcement-bg);
  color: var(--color-announcement-text);
  min-height: var(--announcement-h);
  display: flex;
  align-items: center;
  justify-content: center;
}
.announcement-bar__inner { padding: 0 var(--gutter-sm); }
.announcement-bar p { font-size: 14.5px; line-height: 1.4; text-align: center; }
.announcement-bar a { text-decoration: underline; text-underline-offset: 3px; }
.announcement-bar a:hover { color: #cfcfcf; }

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

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--color-header-border);
  position: sticky; top: 0; z-index: 20;
}
.site-header__inner {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.site-header__logo { display: inline-flex; align-items: center; justify-self: start; }
.site-header__logo:hover { opacity: .7; }
.wordmark { width: 140px; height: auto; display: block; }

.site-header__nav ul { display: flex; gap: 28px; align-items: center; }
.site-header__nav a { font-size: 14px; line-height: 1; padding: 8px 0; display: inline-block; }
.site-header__nav a[aria-current="page"] { border-bottom: 1px solid currentColor; }

.site-header__actions { justify-self: end; display: flex; align-items: center; gap: 12px; }

/* ---------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--button-border-radius);
  font-family: var(--font-medium);
  font-size: 15px; line-height: 1;
  padding: 12px 26px;
  border: 1px solid var(--color-accent);
  transition: opacity .18s ease, background-color .18s ease, color .18s ease;
  cursor: pointer;
}
.btn--solid { background: var(--color-accent); color: #fff; }
.btn--solid:hover { opacity: .82; color: #fff; }
.btn--outline { background: transparent; color: var(--color-accent); }
.btn--outline:hover { background: var(--color-accent); color: #fff; }
.header__cta { padding: 10px 24px; }

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

.page-header { padding-top: 44px; padding-bottom: 32px; }
.page-header__inner { text-align: center; }
.page-title { font-family: var(--font-medium); font-size: 28px; line-height: 1.2; }
.page-subtitle { margin-top: 10px; font-size: 15px; color: var(--color-muted); }

main > section { padding-top: 0; padding-bottom: var(--section-gap); }
.section-title { font-family: var(--font-medium); font-size: 20px; margin-bottom: 20px; }

.prose { max-width: 62ch; }
.lede { font-size: 20px; line-height: 1.6; }
.issue-meta { margin-top: 12px; font-size: 15px; color: var(--color-muted); }
.issue-meta a { text-decoration: underline; text-underline-offset: 3px; }

/* ----------------------------------------------------------- reader */

.reader { border: 1px solid var(--color-border); background: #fff; }

.reader__toolbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  position: sticky; top: var(--header-h); z-index: 10;
}
.reader__group { display: flex; align-items: center; gap: 8px; }
.reader__btn {
  font-family: var(--font-body); font-size: 14px; line-height: 1;
  padding: 9px 14px; min-width: 38px;
  background: #fff; color: var(--color-accent);
  border: 1px solid var(--color-border);
  border-radius: var(--button-border-radius);
  cursor: pointer;
}
.reader__btn:hover:not(:disabled) { background: var(--color-accent3); color: var(--color-accent); }
.reader__btn:disabled { opacity: .35; cursor: default; }
.reader__btn--link { display: inline-flex; align-items: center; }
.reader__pager { font-size: 14px; color: var(--color-muted); min-width: 74px; text-align: center; }

.reader__stage {
  background: var(--color-accent3);
  overflow: auto;
  height: min(78vh, 900px);
  padding: 20px 0;
  scroll-behavior: smooth;
}
.reader:fullscreen .reader__stage,
.reader:-webkit-full-screen .reader__stage { height: calc(100vh - 60px); }
.reader:fullscreen .reader__toolbar { top: 0; }

.reader__pages { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.reader__page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.14); position: relative; }
.reader__page canvas { display: block; }

.reader__status { text-align: center; padding: 60px 20px; color: var(--color-muted); font-size: 15px; }
.reader__status .btn { margin-top: 16px; }
.reader__fallback { padding: 48px 20px; text-align: center; }
.reader__fallback p + p { margin-top: 16px; }

/* --------------------------------------------------------- contents */

.contents { border-top: 1px solid var(--color-border); }
.contents__item {
  display: grid; grid-template-columns: 58px 1fr; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--color-border);
}
.contents__page { font-family: var(--font-medium); font-size: 15px; color: var(--color-muted); padding-top: 3px; }
.contents__title { font-family: var(--font-medium); font-size: 18px; line-height: 1.35; }
.contents__byline { font-size: 14px; color: var(--color-muted); margin-top: 2px; }
.contents__excerpt { margin-top: 8px; max-width: 68ch; font-size: 16px; line-height: 1.65; }

.credits { border-top: 1px solid var(--color-border); max-width: 520px; }
.credits__row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.credits dt { color: var(--color-muted); font-size: 15px; }
.credits dd { margin: 0; font-size: 15px; }

/* ------------------------------------------------------ issue cards */

.issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 48px 32px; }
.issue-card__link { display: grid; gap: 6px; }
.issue-card__cover { display: block; background: var(--color-accent3); overflow: hidden; margin-bottom: 14px; }
.issue-card__cover img { display: block; width: 100%; height: auto; transition: transform .4s cubic-bezier(.22,.61,.36,1); }
.issue-card__link:hover .issue-card__cover img { transform: scale(1.02); }
.issue-card__meta { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-muted); }
.issue-card__title { font-family: var(--font-medium); font-size: 20px; }
.issue-card__summary { font-size: 15px; line-height: 1.6; color: #333; }
.issue-card__cta { margin-top: 6px; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }
.empty { color: var(--color-muted); }

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

.site-footer { border-top: 1px solid var(--color-border); margin-top: 24px; }
.site-footer__inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px;
  padding-top: 48px; padding-bottom: 48px;
}
.footer__heading { font-family: var(--font-medium); font-size: 15px; margin-bottom: 12px; }
.site-footer__inner a { font-size: 15px; line-height: 26px; }

.site-footer__bar { background: var(--color-footer-bar-bg); color: var(--color-footer-bar-text); }
.site-footer__bar-inner {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  align-items: center; justify-content: space-between;
  padding-top: 18px; padding-bottom: 18px; font-size: 13px;
}
.footer__legal { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer__legal a { font-size: 13px; }

/* ------------------------------------------------------ responsive */

@media (max-width: 1100px) { :root { --gutter: 48px; } }

@media (max-width: 860px) {
  :root { --gutter: var(--gutter-sm); --section-gap: 40px; }
  .site-header__inner {
    grid-template-columns: auto 1fr;
    grid-template-areas: "logo cta" "nav nav";
    padding-top: 12px; padding-bottom: 12px; gap: 12px;
  }
  .site-header__logo { grid-area: logo; }
  .site-header__actions { grid-area: cta; }
  .site-header__nav { grid-area: nav; overflow-x: auto; }
  .site-header__nav ul { gap: 20px; white-space: nowrap; }
  .site-header { position: static; }
  .reader__toolbar { position: static; }
  .wordmark { width: 110px; }
  .page-title { font-size: 24px; }
  .reader__stage { height: 70vh; }
  .contents__item { grid-template-columns: 42px 1fr; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .announcement-bar, .site-header, .reader__toolbar, .site-footer__bar { display: none; }
}

/* Cover placeholder — shown until an issue has a cover image on the CDN. */
.issue-card__cover--empty { aspect-ratio: 1275 / 1650; display: block; }
.issue-card__placeholder {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  height: 100%; padding: 24px;
  border: 1px solid var(--color-border); background: var(--color-accent3);
}
.issue-card__placeholder-label {
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-muted);
}
.issue-card__placeholder-title { font-family: var(--font-medium); font-size: 22px; line-height: 1.2; }

/* Drag-to-pan. Only advertise the grab cursor to devices with a real pointer —
   on a touchscreen the viewer scrolls natively and there is nothing to grab. */
@media (hover: hover) and (pointer: fine) {
  .reader__stage { cursor: grab; }
  .reader__stage.is-grabbing { cursor: grabbing; }
}
.reader__stage.is-grabbing { user-select: none; }
.reader__page canvas { user-select: none; -webkit-user-drag: none; }
