/* eslint-disable */

// ── HERO ──────────────────────────────────────────────────────────────────────
const WardrobeHero = () => (
  <section className="types-hero">
    <div className="hero-bg" style={{ backgroundImage: `url(https://images.unsplash.com/photo-1551488831-00ddcb6c6bd3?w=2400&q=80)` }}></div>
    <div className="hero-scrim"></div>
    <Nav />
    <div className="container">
      <div className="types-crumbs">
        <a href="/">Home</a>
        <span className="sep">/</span>
        <a href="/en/pack/">Pack</a>
        <span className="sep">/</span>
        <span className="here">Climate &amp; Wardrobe</span>
      </div>
      <div className="types-mast">
        <div>
          <div className="kicker-row">
            <span className="layer-tag">THE PACKING DESK · CHAPTER III · 10 GUIDES</span>
          </div>
          <h1>Climate &amp; Wardrobe<em>layers do the work.</em></h1>
        </div>
        <p className="lede">
          What to wear, what to bring, and how the right wardrobe fits two weeks and three climates into a single carry-on. The three-layer system. The 5-4-3-2-1 capsule formula. <em>Two pairs of shoes — never three.</em>
        </p>
      </div>

      <div className="types-rail">
        {WARDROBE_CARDS.map(c => (
          <a key={c.id} href={c.href}>
            <span className="n">{c.num}</span>
            <span className="t">{c.title}{c.titleEm ? ` ${c.titleEm}` : ""}</span>
          </a>
        ))}
      </div>
    </div>

    <div className="hero-coord">45°45′N · 4°50′E · LYON, FRANCE</div>
    <div className="hero-credit">PHOTO — PACK DESK Nº 031</div>
  </section>
);

// ── CARD GRID ─────────────────────────────────────────────────────────────────
const WardrobeCard = ({ card }) => (
  <a
    href={card.href}
    className={`lane ${card.size}${card.isZoe ? " zoe-card" : ""}`}
  >
    <div className="img" style={{ backgroundImage: `url(${card.img})` }}></div>
    <div className="scrim"></div>
    <span className="corner-num">{card.num}</span>
    {card.badge && (
      <span className={`corner-tag${card.isZoe ? " zoe-badge" : ""}`}>
        {card.badge}
      </span>
    )}
    <div className="body">
      <div className={`topic${card.isZoe ? " zoe-topic" : ""}`}>
        <span className="dot"></span>{card.topic}
      </div>
      <h3>{card.title}{card.titleEm && <em> {card.titleEm}</em>}</h3>
      <p className="desc">{card.desc}</p>
      <div className="meta">
        <span>{card.count}</span>
        <span>·</span>
        <span>{card.read}</span>
        <span className="arrow"><Icon name="arrow" size={14} /></span>
      </div>
    </div>
  </a>
);

const WardrobeGrid = () => (
  <section className="types-lanes" id="guides">
    <div className="container">
      <div className="types-section-head">
        <div className="num">I</div>
        <div className="titles">
          <h2>The wardrobe <em>guides.</em></h2>
          <p>Ten chapters on climate-aware dressing — from fabric science to dress codes, capsule formulas to cold-weather carry-on. Each card is a future article.</p>
        </div>
        <div className="right">10 guides <Icon name="arrow" size={12} /></div>
      </div>
      <div className="lane-grid">
        {WARDROBE_CARDS.map(c => <WardrobeCard key={c.id} card={c} />)}
      </div>
    </div>
  </section>
);

// ── ESSAY ─────────────────────────────────────────────────────────────────────
const WardrobeEssay = () => (
  <section className="types-essay">
    <div className="container">
      <div className="types-section-head">
        <div className="num">II</div>
        <div className="titles">
          <h2>Field notes <em>on packing light.</em></h2>
          <p>From the Pack Desk — the principles that hold across every climate, every trip length, and every style of travel.</p>
        </div>
        <div className="right">Read the essay <Icon name="arrow" size={12} /></div>
      </div>
      <div className="essay-spread">
        <div className="essay-lhs">
          <p className="pull">"The wardrobe is not <em>what you own.</em> It's the edit you make before the bag closes."</p>
          <div className="byline">
            <div className="av" style={{ backgroundImage: `url(https://images.unsplash.com/photo-1607746882042-944635dfe10e?w=200&q=80)` }}></div>
            <div className="who">
              <div className="name">Iris Mendoza</div>
              <div className="role">Senior Editor · Pack Desk</div>
            </div>
          </div>
        </div>
        <div className="essay-rhs">
          <p>Most packing advice is a list. Lists are useful at the end of the process — when you're checking off what you've already decided to bring. They're useless at the beginning, which is where the real decisions happen.</p>
          <p>The real decisions are about <em>system, not selection.</em> Once you understand the three-layer logic, the 5-4-3-2-1 capsule, and why two pairs of shoes almost always suffice, the list writes itself. You're no longer asking "should I bring this?" — you're asking "which version of this slot does this item fill?"</p>
          <p>The most common packing mistake isn't forgetting something. It's bringing two things that occupy the same slot. Two walking shoes. Two light jackets that do the same job. Four tops when two would mix to the same twelve outfits. The edit is harder than the list — but it's the only thing that makes carry-on feasible for two weeks.</p>
          <p>The wardrobe question is settled before the bag opens. That's where this desk works.</p>
        </div>
      </div>
      <div className="essay-stats">
        {WARDROBE_STATS.map((s, i) => (
          <div key={i} className="item">
            <div className="n">{s.n}</div>
            <div className="l">{s.l.split("\n").map((line, j) => <span key={j}>{line}<br /></span>)}</div>
          </div>
        ))}
      </div>
    </div>
  </section>
);

// ── CLIMATE MATRIX (interactive) ──────────────────────────────────────────────
const CLIMATES = [
  {
    id: "cold",
    label: "Cold & Dry",
    range: "Below 5°C",
    base: "Merino heavyweight base",
    mid: "Fleece or down mid-layer",
    shell: "Waterproof hard shell",
    shoes: "Insulated boots + light sneaker",
    extras: "Thin gloves, merino hat",
    guide: "/en/pack/climate-and-wardrobe/cold-weather-carry-on/",
  },
  {
    id: "cool",
    label: "Cool & Shoulder",
    range: "5°C – 15°C",
    base: "Merino lightweight base",
    mid: "Fleece or packable down",
    shell: "Packable rain shell",
    shoes: "Walking shoe + loafer",
    extras: "Scarf (doubles as blanket)",
    guide: "/en/pack/climate-and-wardrobe/shoulder-season-layering/",
  },
  {
    id: "temperate",
    label: "Temperate",
    range: "15°C – 24°C",
    base: "Merino lightweight tee",
    mid: "Linen or light fleece",
    shell: "Packable wind shell",
    shoes: "Walking shoe + smart shoe",
    extras: "One layer on the plane",
    guide: "/en/pack/climate-and-wardrobe/capsule-formula/",
  },
  {
    id: "hot",
    label: "Hot & Humid",
    range: "Above 24°C",
    base: "Linen or technical wicking tee",
    mid: "None needed most days",
    shell: "Ultralight rain packable",
    shoes: "Breathable walking shoe + sandal",
    extras: "Double wicking tops, quick-dry bottoms",
    guide: "/en/pack/climate-and-wardrobe/hot-humid-fabrics/",
  },
];

const ClimateMatrix = () => {
  const [active, setActive] = React.useState("temperate");
  const current = CLIMATES.find(c => c.id === active);

  return (
    <section className="types-decide" id="climate-matrix">
      <div className="container">
        <div className="types-section-head">
          <div className="num">III</div>
          <div className="titles">
            <h2>Pick your climate. <em>See the stack.</em></h2>
            <p>Select the weather zone — the layer-by-layer recommendation updates as you go. No email required, no quiz to complete.</p>
          </div>
          <div className="right">4 climate zones</div>
        </div>

        <div className="decide-shell">
          <div className="decide-lhs">
            <div className="lbl">CLIMATE SELECTOR</div>
            <h3>Your zone,<em>your stack.</em></h3>
            <p>The three-layer system is the same for every climate — what changes is the weight and material of each layer. Select your zone to see the right combination.</p>
            <div className="result" style={{ marginTop: 24 }}>
              <div className="r-lbl">TEMPERATURE RANGE</div>
              <div className="r-type" style={{ fontSize: 28 }}>{current.range}</div>
              <div className="r-blurb" style={{ marginTop: 8, fontSize: 14, lineHeight: 1.5 }}>
                <strong>Base:</strong> {current.base}<br />
                <strong>Mid:</strong> {current.mid}<br />
                <strong>Shell:</strong> {current.shell}<br />
                <strong>Shoes:</strong> {current.shoes}<br />
                <strong>Notes:</strong> {current.extras}
              </div>
              <a href={current.guide} style={{
                display: "inline-flex", alignItems: "center", gap: 8,
                marginTop: 16, fontSize: 13, fontFamily: "var(--mono, monospace)",
                letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--tan, #d4a574)"
              }}>
                Read the full guide <Icon name="arrow" size={12} />
              </a>
            </div>
          </div>
          <div className="decide-rhs">
            {CLIMATES.map(c => (
              <div key={c.id} className="q-block" style={{ cursor: "pointer" }} onClick={() => setActive(c.id)}>
                <div className="q-num">{c.range}</div>
                <div className="q-label">{c.label}</div>
                <div className="q-opts">
                  <button
                    className={`q-opt${active === c.id ? " sel" : ""}`}
                    onClick={(e) => { e.stopPropagation(); setActive(c.id); }}
                  >
                    {active === c.id ? "Selected" : "Select this zone"}
                  </button>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

// ── READING LIST ──────────────────────────────────────────────────────────────
const WardrobeReading = () => (
  <section className="types-reading" id="reading">
    <div className="container">
      <div className="types-section-head">
        <div className="num">IV</div>
        <div className="titles">
          <h2>The reading list <em>by wardrobe topic.</em></h2>
          <p>Six essays from the Pack Desk. Pick the challenge you're solving — the rest is bedside reading.</p>
        </div>
        <div className="right">All essays <Icon name="arrow" size={12} /></div>
      </div>
      <div>
        {WARDROBE_READING.map((r, i) => (
          <a key={i} href="/journal/" className="reading-row-t">
            <div className="num">{String(i + 1).padStart(2, "0")}</div>
            <div className="title">{r.title}</div>
            <div className="tag">{r.tag}</div>
            <div className="duration">{r.duration}</div>
          </a>
        ))}
      </div>
    </div>
  </section>
);

// ── FAQ ───────────────────────────────────────────────────────────────────────
const WardrobeFAQ = () => {
  const [open, setOpen] = React.useState(0);
  return (
    <section className="types-faq" id="faq">
      <div className="container">
        <div className="faq-grid">
          <div className="faq-lhs">
            <div className="lbl">FREQUENTLY · BUT QUIETLY · ASKED</div>
            <h3>What readers<em>actually ask.</em></h3>
            <p>Wardrobe letters from the Pack Desk, lightly edited. Seven questions, honest answers.</p>
          </div>
          <div className="faq-list">
            {WARDROBE_FAQS.map((f, i) => (
              <div key={i} className={`faq-item ${open === i ? "open" : ""}`} onClick={() => setOpen(open === i ? -1 : i)}>
                <div className="q">
                  <span>{f.q}</span>
                  <span className="toggle">+</span>
                </div>
                <div className="a">{f.a}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

// ── CTA ───────────────────────────────────────────────────────────────────────
const WardrobeCTA = () => (
  <section className="types-cta">
    <div className="bg" style={{ backgroundImage: `url(https://images.unsplash.com/photo-1529655683826-aba9b3e77383?w=2000&q=80)` }}></div>
    <div className="inner">
      <div className="kicker">THE PACK DESK · CLIMATE &amp; WARDROBE</div>
      <h2>Layers do <em>the work.</em></h2>
      <p>Pick the climate zone. Learn the system. Pack the capsule. Two weeks. One carry-on. Nothing you won't wear.</p>
      <div className="actions">
        <a href="/en/pack/climate-and-wardrobe/three-layer-system/" className="btn-p">Start with the three layers →</a>
        <a href="/en/pack/" className="btn-g">Back to Pack</a>
      </div>
    </div>
  </section>
);

// ── ROOT ──────────────────────────────────────────────────────────────────────
const WardrobeApp = () => (
  <>
    <WardrobeHero />
    <WardrobeGrid />
    <WardrobeEssay />
    <ClimateMatrix />
    <WardrobeReading />
    <WardrobeFAQ />
    <WardrobeCTA />
    <Footer />
  </>
);

ReactDOM.createRoot(document.getElementById("root")).render(<WardrobeApp />);
