/* Sam's article - Floating Shelves Look Hard. They're Not. Here's Proof.
 * Format: Sam editorial - Hero, Lede, WhatYouNeed, Steps, HotTakes, Redo, Signoff.
 */

const SamSays = ({ children }) => (
  <div className="sa-step-says">
    <span className="who">- Sam</span>
    <p>{children}</p>
  </div>
);

const heroImage = "https://images.unsplash.com/photo-1616594039964-ae9021a400a0?w=2000&q=84";

const Crumbs = () => (
  <nav className="sa-crumbs" aria-label="Breadcrumb">
    <div className="l">
      <a href="/">Home</a>
      <span>/</span>
      <a href="/en/contributors/sam/">Sam</a>
      <span>/</span>
      <span>How-to</span>
      <span>/</span>
      <span style={{ color: "#EFE5CF" }}>Floating shelves</span>
    </div>
    <div className="r">
      <span>Issue 04 | Spring '26</span>
      <span className="by">written by Sam</span>
    </div>
  </nav>
);

const Hero = () => (
  <section className="sa-hero">
    <div className="img" style={{ backgroundImage: `url('${heroImage}')` }} />
    <div className="sa-hero-wrap">
      <div>
        <div className="sa-hero-kicker">
          <span>How-to</span>
          <span className="dot">*</span>
          <span>No. 04</span>
          <span className="dot">*</span>
          <span className="sig">written by Sam</span>
        </div>
        <h1>
          Floating shelves look hard. <em>They're not.</em>
        </h1>
        <p className="standfirst">
          No visible brackets. No complicated hardware. Just a wall that finally looks like you meant it. Find the studs, buy the right bracket, finish the shelf first, and do not rush the last step.
        </p>
      </div>
      <div className="sa-hero-side">
        <div className="row">
          <span>Time</span>
          <span className="v">One afternoon</span>
        </div>
        <div className="row">
          <span>Cost</span>
          <span className="v">$35-$160</span>
        </div>
        <div className="row">
          <span>Skill</span>
          <span className="v">Beginner-plus</span>
        </div>
        <div className="row">
          <span>Mess factor</span>
          <span className="v warn">Dust + drilling</span>
        </div>
        <div className="row">
          <span>Updated</span>
          <span className="v">Spring '26</span>
        </div>
      </div>
    </div>
    <div className="sa-hero-scribble">
      studs first. <u>style second.</u>
      <svg viewBox="0 0 60 30" fill="none">
        <path d="M2 22 C 12 8, 28 4, 56 12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
        <path d="M48 6 L 56 12 L 50 20" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" fill="none" />
      </svg>
    </div>
  </section>
);

const Lede = () => (
  <section className="sa-lede">
    <div className="sa-lede-wrap">
      <aside className="sa-lede-side">
        <div className="marker">In this one</div>
        <ul>
          <li>Find every stud first</li>
          <li>Pick the bracket route</li>
          <li>Finish before hanging</li>
          <li>Predrill and level</li>
          <li>Shim, caulk, style</li>
        </ul>
      </aside>

      <div className="sa-lede-body">
        <p className="dropcap">
          Floating shelves have a reputation they do not deserve.
        </p>
        <p>
          People see them in design photos and assume there is some contractor secret involved: hidden blocking, special anchors, a level of precision beyond a regular Saturday afternoon. There is not. The whole trick is about three things: finding your studs, buying the right bracket, and not rushing the last step.
        </p>
        <div className="sa-pullquote">
          <p>
            If you have ever hung a picture frame, you have enough experience to do this. It is the same idea, just heavier.
          </p>
        </div>
        <p>
          That is it. That is the secret. The shelf looks magic from the front, but the wall is doing the work behind it.
        </p>
      </div>

      <aside className="sa-margin">
        <span className="lab">Sam's note</span>
        <h4>No drywall-only heroics</h4>
        <p>
          A shelf holding books, plants, or ceramics needs to hit studs. Drywall anchors will hold for a while, and then fail at the worst possible moment.
        </p>
      </aside>
    </div>
  </section>
);

const WhatYouNeed = () => (
  <section className="sa-need">
    <div className="sa-need-wrap">
      <div>
        <div className="sa-need-head">01 / Hardware store</div>
        <h2>
          What you <em>actually</em> need
        </h2>
        <p className="body">
          Mark your studs before you shop. The distance between studs decides what bracket and shelf length actually work for your wall.
        </p>

        <div className="sa-need-dont">
          <span className="lab">Don't bother with</span>
          <ul>
            <li>
              Drywall anchors for loaded shelves
              <span className="why">They are not the plan for books, plants, ceramics, or anything with consequence.</span>
            </li>
            <li>
              Screws that are too short
              <span className="why">You need to pass through bracket and drywall and still bite deep into wood.</span>
            </li>
            <li>
              Finishing after install
              <span className="why">Painting on a ladder is how you learn regret with your shoulders.</span>
            </li>
          </ul>
        </div>
      </div>

      <ul className="sa-need-list">
        <li>
          <span className="item">
            Stud finder or strong magnet
            <span className="why">A magnet finds the drywall screws that usually mark studs.</span>
          </span>
          <span className="qty">1</span>
        </li>
        <li>
          <span className="item">
            Hidden bracket or visible brackets
            <span className="why">Hidden for the design-photo look; visible for the more forgiving first run.</span>
          </span>
          <span className="qty">Set</span>
        </li>
        <li>
          <span className="item">
            1x10 or 1x12 board
            <span className="why">Pine is cheap. Poplar paints well. Oak and walnut cost more and weigh more.</span>
          </span>
          <span className="qty">Cut</span>
        </li>
        <li>
          <span className="item">
            Level
            <span className="why">Four-foot if you have it, two-foot minimum.</span>
          </span>
          <span className="qty">1</span>
        </li>
        <li>
          <span className="item">
            Drill and bits
            <span className="why">Predrilling keeps drywall clean and screws seated.</span>
          </span>
          <span className="qty">Set</span>
        </li>
        <li>
          <span className="item">
            2.5-inch or 3-inch screws
            <span className="why">Long enough to get at least 1.5 inches into the stud.</span>
          </span>
          <span className="qty">Pack</span>
        </li>
        <li>
          <span className="item">
            Sandpaper, paint, or stain
            <span className="why">Finish the shelf before it goes up.</span>
          </span>
          <span className="qty">Enough</span>
        </li>
      </ul>
    </div>
  </section>
);

const STEPS = [
  {
    n: "01",
    phase: "Find | 15 min",
    title: "Mark every stud in the target zone.",
    flip: false,
    body: (
      <>
        <p>
          Walk over to the wall and knock. Hollow is drywall with nothing behind it. Solid is where a stud is. Run a stud finder if you have one. If you do not, a strong magnet will find the drywall screws that mark where studs are.
        </p>
        <p>
          Mark every stud with tape. Studs are usually 16 inches apart, but do not design the shelf around usually. Measure the wall you actually have.
        </p>
      </>
    ),
    warn: { lab: "Studs, not hope", text: "Drywall anchors are not the support plan for a real shelf. They are the support plan for future sadness." },
    fig: { img: heroImage, tag: "Fig 01 | Stud map", cap: "the bracket only works if the wall is doing its part." },
    says: "Mark all the studs before you go shopping. The bracket has to fit the wall, not the mood board."
  },
  {
    n: "02",
    phase: "Choose | 20 min",
    title: "Pick your bracket route.",
    flip: true,
    body: (
      <>
        <p>
          Route one is the hidden bracket system: metal rods or a plate screw into studs, and the shelf slides over so nothing shows from the front or sides. This is the clean design-photo version.
        </p>
        <p>
          Route two is a traditional bracket with a wood shelf on top. The bracket is visible underneath, but it is faster, more forgiving, and easier to adjust as you go. For a first project, route two is the move.
        </p>
      </>
    ),
    tip: { lab: "Bracket finish", text: "Black iron works modern. Brass warms it up. Basic silver utility brackets only work if you mean to go industrial." },
    fig: { img: "https://images.unsplash.com/photo-1600585154340-be6161a56a0c?w=1200&q=84", tag: "Fig 02 | Route", cap: "hidden hardware or honest hardware. both work." }
  },
  {
    n: "03",
    phase: "Finish | 1-2 hrs active",
    title: "Finish the shelf before it touches the wall.",
    flip: false,
    body: (
      <>
        <p>
          Sand the board before anything else. Start with 120-grit to knock down rough spots, then go over it with 220-grit until it feels smooth. Wipe the dust with a damp cloth and let it dry.
        </p>
        <p>
          Paint or stain it now. Two coats. If you are painting, a light sand between coats makes the final surface look like it came from a store instead of the lumber aisle.
        </p>
      </>
    ),
    warn: { lab: "Cure time matters", text: "Dry to the touch is not cured. Give most paints at least 24 hours before the shelf gets handled and loaded." },
    fig: { img: "https://images.unsplash.com/photo-1589939705384-5185137a7f0f?w=1200&q=80", tag: "Fig 03 | Finish first", cap: "flat on sawhorses beats crouched on a ladder." },
    says: "The shelf is easier to make beautiful before it is attached to a wall. Obvious, yet somehow often ignored."
  },
  {
    n: "04",
    phase: "Hang | 45 min",
    title: "Predrill, level, then tighten.",
    flip: true,
    body: (
      <>
        <p>
          Hold the bracket where you want the shelf. Mark through the bracket holes. Set it aside and check the marks. If at least two screws land on studs, proceed. If not, shift the bracket.
        </p>
        <p>
          Predrill slowly. Set both screws snug, check level, then tighten the rest of the way. A bracket that goes in at a slight angle is miserable to fix after the fact.
        </p>
      </>
    ),
    tip: { lab: "Screw length", text: "Drywall is about half an inch thick, then the bracket has thickness. Use 2.5-inch or 3-inch screws so there is real bite into the stud." },
    fig: { img: "https://images.unsplash.com/photo-1581244277943-fe4a9c777189?w=1200&q=80", tag: "Fig 04 | Level", cap: "snug first. level second. tighten third." }
  },
  {
    n: "05",
    phase: "Finish | 20 min",
    title: "Shim, caulk, then style it.",
    flip: false,
    body: (
      <>
        <p>
          Almost no wall is perfectly flat. If the shelf rocks or there is a gap where the back edge meets the wall, do not panic. A thin shim behind the bracket fixes the rock. A small bead of paintable caulk closes the gap.
        </p>
        <p>
          Style with heavy things in the middle and lighter things toward the ends. Books and ceramics are fine. A fish tank is not. Odd numbers look better than even ones, and empty space counts as design.
        </p>
      </>
    ),
    tip: { lab: "Not a failure", text: "Shims and caulk are not coverups. They are finishes. Professionals use them constantly." },
    fig: { img: "https://images.unsplash.com/photo-1616486338812-3dadae4b4ace?w=1200&q=84", tag: "Fig 05 | Style", cap: "the wall finally looks intentional." },
    says: "You built the shelf. You get to decide what goes on it."
  }
];

const Step = ({ data }) => (
  <article className={`sa-step ${data.flip ? "flip" : ""}`}>
    <div className="sa-step-text">
      <div className="sa-step-meta">
        <span className="sa-step-num">{data.n}</span>
        <span className="sa-step-phase">{data.phase}</span>
      </div>
      <h3>{data.title}</h3>
      <div className="sa-step-body">{data.body}</div>
      {data.tip && (
        <div className="sa-step-tip">
          <span className="lab">{data.tip.lab}</span>
          <p>{data.tip.text}</p>
        </div>
      )}
      {data.warn && (
        <div className="sa-step-warn">
          <span className="lab">{data.warn.lab}</span>
          <p>{data.warn.text}</p>
        </div>
      )}
    </div>
    <figure className="sa-step-fig">
      <div className="frame">
        <span className="tag">{data.fig.tag}</span>
        <img src={data.fig.img} alt="" loading="lazy" />
      </div>
      <figcaption>{data.fig.cap}</figcaption>
      {data.says && <SamSays>{data.says}</SamSays>}
    </figure>
  </article>
);

const Steps = () => (
  <section className="sa-steps">
    <div className="sa-steps-wrap">
      <header className="sa-steps-head">
        <h2>
          The <em>five</em> moves
        </h2>
        <span className="count">05 MOVES | ONE AFTERNOON ACTIVE</span>
      </header>
      {STEPS.map((s) => (
        <Step key={s.n} data={s} />
      ))}
    </div>
  </section>
);

const HotTakes = () => (
  <section className="sa-hottakes">
    <div className="sa-hottakes-wrap">
      <header className="sa-hottakes-head">
        <span className="lab">Sam's hot takes</span>
        <h2>
          Things I'm <em>tired</em> of seeing
        </h2>
      </header>
      <div className="sa-hottakes-list">
        <div className="sa-take">
          <div className="num">i.</div>
          <h3>Buying the shelf before finding studs</h3>
          <p>
            The wall decides what fits. Measure the studs first, then buy hardware that actually lands where it needs to.
          </p>
        </div>
        <div className="sa-take">
          <div className="num">ii.</div>
          <h3>Trusting drywall anchors with books</h3>
          <p>
            A candle, maybe. Books, plants, ceramics, or anything breakable? Studs. Every time.
          </p>
        </div>
        <div className="sa-take">
          <div className="num">iii.</div>
          <h3>Using short screws</h3>
          <p>
            The screw has to pass through bracket and drywall and still bite into wood. Half the failures are just tiny screws pretending to be structural.
          </p>
        </div>
        <div className="sa-take">
          <div className="num">iv.</div>
          <h3>Crowding the shelf the second it goes up</h3>
          <p>
            You installed negative space too. Let it breathe before you turn it into a storage ledge.
          </p>
        </div>
      </div>
    </div>
  </section>
);

const Redo = () => (
  <section className="sa-redo">
    <div className="sa-redo-wrap">
      <aside className="sa-redo-side">
        what gets
        <br />
        <em style={{ color: "#D97A4F" }}>you</em>
        <svg viewBox="0 0 80 60" fill="none">
          <path d="M5 12 C 25 6, 55 14, 70 38" stroke="#91A86C" strokeWidth="2" strokeLinecap="round" />
          <path d="M64 30 L 70 38 L 60 42" stroke="#91A86C" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" fill="none" />
        </svg>
      </aside>
      <div>
        <h2>
          The wall is not <em>flat.</em>
        </h2>
        <p>
          Almost no wall is. If your shelf rocks slightly or there is a gap at one end, do not read that as failure. A thin shim behind the bracket on the low side fixes the rock.
        </p>
        <p>
          A small bead of paintable caulk along the back edge closes the gap and makes the shelf look intentional. These are not tricks. They are finishes. Every professional carpenter uses them. Now you do too.
        </p>
      </div>
    </div>
  </section>
);

const Signoff = () => (
  <section className="sa-signoff">
    <div className="sa-signoff-wrap">
      <div>
        <h2>
          It is level. <em>It looks good.</em>
        </h2>
        <p>
          It took you an afternoon. The wall finally looks like you meant it, and the shelf is ready for books, ceramics, plants, or exactly one object with too much confidence.
        </p>
        <div className="sig">- Sam</div>
        <div className="ctas" style={{ marginTop: 28 }}>
          <a href="/contact/" className="btn primary">
            Send a photo
          </a>
          <a href="/en/contributors/sam/" className="btn ghost">
            More from Sam
          </a>
        </div>
      </div>
      <div className="sa-readnext">
        <span className="lab">Read next</span>
        <a href="/en/contributors/sam/how-to-hang-something-heavy-without-asking-anyone-for-help/">
          <span>Hang something heavy without help</span>
          <span className="m">SAM</span>
        </a>
        <a href="/en/contributors/sam/how-to-paint-exposed-attic-rafters/">
          <span>Paint exposed attic rafters</span>
          <span className="m">SAM</span>
        </a>
        <a href="/en/build/living-room/how-to-build-floating-shelves/">
          <span>Build floating shelves</span>
          <span className="m">HUB</span>
        </a>
        <a href="/en/contributors/sam/">
          <span>All of Sam's guides</span>
          <span className="m">PROFILE</span>
        </a>
      </div>
    </div>
  </section>
);

const Article = () => (
  <div className="sa">
    <Crumbs />
    <Hero />
    <Lede />
    <WhatYouNeed />
    <Steps />
    <HotTakes />
    <Redo />
    <Signoff />
  </div>
);

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