<?php
declare(strict_types=1);
ini_set('display_errors','0');
ini_set('session.use_strict_mode','1');
session_set_cookie_params(['httponly'=>true,'samesite'=>'Lax','secure'=>!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off']);
session_start();
header('Cache-Control: no-store');
header('X-Content-Type-Options: nosniff');
function h($s): string { return htmlspecialchars((string)$s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); }
if (empty($_SESSION['csrf'])) { $_SESSION['csrf']=bin2hex(random_bytes(32)); $_SESSION['form_started']=time(); }
$choices=['The Stargazer','Sunday Porch','Pink Detour','Golden Hour','Blue Hour','More than one / not sure'];
$values=array_fill_keys(['name','email','phone','candy','quantity','message'],''); $errors=[];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
 foreach ($values as $key => $v) { $values[$key]=is_string($_POST[$key] ?? null) ? trim($_POST[$key]) : ''; }
 if (!is_string($_POST['csrf'] ?? null) || !hash_equals($_SESSION['csrf'], $_POST['csrf'])) $errors[]='Your form session expired. Please try again.';
 if (!empty($_POST['website']) || time() - ($_SESSION['form_started'] ?? time()) < 3) $errors[]='Please wait a moment and try again.';
 if (time() - ($_SESSION['last_attempt'] ?? 0) < 30) $errors[]='Please wait 30 seconds before trying again.';
 if ($values['name']==='' || strlen($values['name'])>100 || preg_match('/[\r\n]/',$values['name'])) $errors[]='Please enter a valid name (up to 100 characters).';
 if (!filter_var($values['email'], FILTER_VALIDATE_EMAIL) || strlen($values['email'])>254 || preg_match('/[\r\n]/',$values['email'])) $errors[]='Please enter a valid email address.';
 if (strlen($values['phone'])>40 || ($values['phone']!=='' && !preg_match('/^[0-9+(). -]+$/', $values['phone']))) $errors[]='Please enter a valid phone number.';
 if (!in_array($values['candy'],$choices,true)) $errors[]='Please choose a candy selection.';
 if (!ctype_digit($values['quantity']) || (int)$values['quantity']<1 || (int)$values['quantity']>10000) $errors[]='Please enter a quantity between 1 and 10,000.';
 if ($values['message']==='' || strlen($values['message'])>3000) $errors[]='Please enter a message of up to 3,000 characters.';
 if (!$errors) {
   $_SESSION['last_attempt']=time();
   $body="New candy inquiry\n\nName: ".$values['name']."\nEmail: ".$values['email']."\nPhone: ".$values['phone']."\nCandy: ".$values['candy']."\nQuantity: ".$values['quantity']."\n\nMessage:\n".$values['message'];
   $headers="From: Morrow & Marble <info@xenqalo.cfd>\r\nReply-To: ".$values['email']."\r\nContent-Type: text/plain; charset=UTF-8";
   $sent=@mail('info@xenqalo.cfd','New candy inquiry',$body,$headers);
   if ($sent) { $_SESSION['csrf']=bin2hex(random_bytes(32)); $_SESSION['form_started']=time(); $inquiry_sent=true; include __DIR__.'/thank-you.php'; exit; }
   $errors[]='Email delivery could not be initiated. Please try later or contact us directly at info@xenqalo.cfd or +1 (612) 871-5057.';
 }
 http_response_code(422);
}
?><!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Contact &amp; Order Inquiry | Morrow &amp; Marble</title><meta name="description" content="Contact Morrow &amp; Marble about handmade candy, availability, and order inquiries."><link rel="icon" href="favicon.svg" type="image/svg+xml"><link rel="stylesheet" href="style.css"></head><body><div class="announcement">SMALL BATCHES <span>✳</span> BIG CURIOSITY <span>✳</span> MADE TO BE SHARED</div><header class="header"><a class="brand" href="index.html" aria-label="Morrow and Marble home"><span class="brand-icon">✳</span><span>MORROW <i>&amp;</i> MARBLE<small>HANDMADE CANDY CO.</small></span></a><button class="menu-toggle" type="button" aria-expanded="false" aria-controls="nav">Menu <span>☰</span></button><nav id="nav" aria-label="Main navigation"><a  href="index.html">Home</a><a  href="candies.html">Our Candies</a><a  href="story.html">Our Story</a><a  href="process.html">Handmade Process</a><a  href="journal.html">Journal</a><a  href="faq.html">FAQ</a><a aria-current=page href="contact.php">Contact</a><a class="nav-cta" href="contact.php#inquiry">Inquire <span>↗</span></a></nav></header><main><section class="page-hero wrap"><div class="eyebrow">LET'S TALK CANDY ✳</div><h1>Well, <em>hello there.</em></h1><p>Have a question, a gathering in mind, or a candy you can't stop thinking about? Drop us a note.</p></section><section class="contact-grid wrap"><div class="contact-info"><div class="eyebrow">GET IN TOUCH</div><h2>We're all ears <em>(and sweet tooth).</em></h2><p>Tell us a little about what you're looking for. We'll discuss availability and details directly.</p><div class="contact-detail"><b>EMAIL</b><a href="mailto:info@xenqalo.cfd">info@xenqalo.cfd</a></div><div class="contact-detail"><b>PHONE</b><a href="tel:+16128715057">+1 (612) 871-5057</a></div><div class="contact-detail"><b>BUSINESS ADDRESS</b><p>10832 Upton Ave S<br>Bloomington, MN 55431, USA</p><small>Please contact us before visiting.</small></div></div><div class="form-card" id="inquiry"><div class="eyebrow">ORDER INQUIRY ✳</div><h2>Tell us what you're <em>dreaming up.</em></h2><p>All fields are required unless marked optional. An inquiry is not an order or payment.</p><?php if ($errors): ?><div class="errors" role="alert"><strong>We couldn't send your inquiry.</strong><ul><?php foreach ($errors as $error): ?><li><?= h($error) ?></li><?php endforeach; ?></ul></div><?php endif; ?><form method="post" action="contact.php#inquiry"><input type="hidden" name="csrf" value="<?= h($_SESSION['csrf']) ?>"><div class="trap" aria-hidden="true"><label>Leave this field empty <input name="website" tabindex="-1" autocomplete="off"></label></div><div class="form-row"><label>Name<input name="name" required maxlength="100" autocomplete="name" value="<?= h($values['name']) ?>"></label><label>Email<input type="email" name="email" required maxlength="254" autocomplete="email" value="<?= h($values['email']) ?>"></label></div><div class="form-row"><label>Phone <span>(optional)</span><input type="tel" name="phone" maxlength="40" autocomplete="tel" value="<?= h($values['phone']) ?>"></label><label>Candy Selection<select name="candy" required><option value="">Choose one</option><?php foreach ($choices as $choice): ?><option value="<?= h($choice) ?>" <?= $values['candy'] === $choice ? 'selected' : '' ?>><?= h($choice) ?></option><?php endforeach; ?></select></label></div><label>Quantity <span>(number of pieces)</span><input type="number" name="quantity" min="1" max="10000" required value="<?= h($values['quantity']) ?>"></label><label>Message<textarea name="message" required maxlength="3000" rows="5" placeholder="Tell us about your idea, date, or any questions."><?= h($values['message']) ?></textarea></label><p class="form-note">By sending this form, you acknowledge our <a href="privacy.html">Privacy Policy</a>. Please don't include sensitive personal information.</p><button class="button dark" type="submit">Send inquiry ↗</button></form></div></section></main><footer><div class="footer-top"><div><a class="footer-brand" href="index.html">MORROW <i>&amp;</i> MARBLE <span>✳</span></a><p>A little wonder, made by hand.</p></div><div><b>EXPLORE</b><a href="candies.html">Our candies</a><a href="process.html">Our process</a><a href="journal.html">The journal</a><a href="faq.html">FAQ</a></div><div><b>GET IN TOUCH</b><a href="mailto:info@xenqalo.cfd">info@xenqalo.cfd</a><a href="tel:+16128715057">+1 (612) 871-5057</a><p>10832 Upton Ave S<br>Bloomington, MN 55431, USA</p></div><div class="footer-note"><b>A NOTE FROM US</b><p>Have a question or a sweet idea? We'd love to hear about it.</p><a class="text-link" href="contact.php">Say hello ↗</a></div></div><div class="footer-bottom"><span>© Morrow &amp; Marble. All rights reserved.</span><div><a href="privacy.html">Privacy Policy</a><a href="terms.html">Terms &amp; Conditions</a></div><span>MADE FOR THE CURIOUS ✳</span></div></footer><script src="script.js" defer></script></body></html>