/* ============================================================
   Also Coffee Co — checkout
   Self-contained: pdp.css and pages.css are NOT enqueued here,
   so anything borrowed from them is copied, not referenced.
   ============================================================ */

/* status tokens the theme never had — the only error colours previously in
   the codebase were three hard-coded hex values in woo.css */
:root{
  --error:#C0502B;      --error-bg:#F8E7DE;   --error-ink:#7A2E12;
  --success:#3F7D53;    --success-bg:#E4F0E6;
  --warning:#B9762F;    --warning-bg:#FBEEDC;
}

.also-copage .also-section--tight{padding-block:clamp(1.5rem,3vw,2.6rem) clamp(2.5rem,5vw,4rem)}

.also-co__head{margin-bottom:clamp(1.2rem,2.5vw,2rem)}
.also-co__head h1{
  font-size:clamp(2rem,1.4rem + 2vw,2.9rem);line-height:1.05;
  margin:.3rem 0 0;color:var(--acc-ink-deep);
}

/* ---------- the two columns ---------- */
.also-co__grid{
  display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,.9fr);
  gap:clamp(1.5rem,3.5vw,3.5rem);align-items:start;
}
.also-co__main{grid-column:1;grid-row:1;min-width:0}
.also-co__aside{grid-column:2;grid-row:1;min-width:0}
.also-co__sticky{position:sticky;top:96px}   /* the theme's sticky-header offset */

/* ---------- form scaffolding ---------- */
.also-co .col2-set{display:grid;gap:clamp(1.2rem,2.5vw,2rem)}
.also-co .col2-set .col-1,
.also-co .col2-set .col-2{width:auto;float:none;min-width:0}

.also-co h3,
.also-co .also-co__paytitle{
  font-family:var(--font-display);font-weight:var(--fw-display);
  font-size:clamp(1.15rem,1rem + .6vw,1.45rem);color:var(--acc-ink-deep);
  margin:0 0 .9rem;
}
.also-co__main > * + *{margin-top:clamp(1.4rem,3vw,2.2rem)}

/* card each block so the form reads as steps, not one long sheet */
.also-co #customer_details > .col-1,
.also-co #customer_details > .col-2,
.also-co__pay{
  background:var(--surface-card);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:clamp(1.1rem,2.4vw,1.6rem);
}

/* ---------- fields ---------- */
.also-co .form-row{margin:0 0 .95rem;padding:0;display:block}
.also-co .form-row:last-child{margin-bottom:0}
.also-co .form-row label{
  display:block;font-weight:var(--fw-semibold);font-size:.88rem;
  color:var(--text-strong);margin-bottom:.35rem;
}
.also-co .form-row label .required{color:var(--error);text-decoration:none;margin-left:.15em}
.also-co .form-row .optional{color:var(--text-muted);font-weight:400}

.also-co .input-text,
.also-co select,
.also-co textarea{
  width:100%;font-family:var(--font-body);font-size:1rem;color:var(--text-strong);
  background:var(--surface-card);border:1.5px solid var(--border);
  border-radius:var(--radius-md);padding:.72rem .85rem;min-height:48px;
  transition:border-color var(--dur-fast) var(--ease-out),
             box-shadow var(--dur-fast) var(--ease-out);
}
.also-co textarea{min-height:96px;resize:vertical}
/* a real focus ring — .also-wsform kills its outline, do not copy that */
.also-co .input-text:focus,
.also-co select:focus,
.also-co textarea:focus{
  outline:none;border-color:var(--accent);
  box-shadow:0 0 0 3px var(--acc-blue-pale);
}
.also-co .input-text:focus-visible,
.also-co select:focus-visible,
.also-co textarea:focus-visible{outline:2px solid var(--accent);outline-offset:1px}

/* two-up rows, but never on a phone */
@media (min-width:561px){
  .also-co .form-row-first,
  .also-co .form-row-last{width:calc(50% - .45rem);display:inline-block;vertical-align:top}
  .also-co .form-row-first{margin-right:.85rem}
}

/* ---------- validation: WooCommerce 10.9 already sets these classes,
     the theme simply had no styles for any of them ---------- */
.also-co .form-row.woocommerce-invalid .input-text,
.also-co .form-row.woocommerce-invalid select,
.also-co [aria-invalid="true"]{border-color:var(--error)}
.also-co .form-row.woocommerce-invalid .input-text:focus,
.also-co .form-row.woocommerce-invalid select:focus{box-shadow:0 0 0 3px rgba(192,80,43,.16)}
.also-co .form-row.woocommerce-validated .input-text{border-color:var(--success)}
.also-co .checkout-inline-error-message{
  display:block;margin:.35rem 0 0;font-size:.84rem;font-weight:600;color:var(--error-ink);
}
.also-co .checkout-inline-error-message::before{content:"⚠ ";}

.woocommerce-NoticeGroup-checkout .woocommerce-error,
.also-co .woocommerce-error{
  background:var(--error-bg);color:var(--error-ink);
  border:1px solid rgba(192,80,43,.35);border-top:3px solid var(--error);
  border-radius:var(--radius-md);padding:.9rem 1.1rem;margin:0 0 1.2rem;list-style:none;
}
.woocommerce-NoticeGroup-checkout .woocommerce-error li{margin:.2rem 0}
.woocommerce-NoticeGroup-checkout .woocommerce-error a{color:var(--error-ink);font-weight:700}

/* ---------- checkboxes ---------- */
.also-co .woocommerce-form__label-for-checkbox{
  display:flex;align-items:flex-start;gap:.6rem;font-weight:600;cursor:pointer;
}
.also-co .woocommerce-form__input-checkbox{
  flex:none;width:20px;height:20px;margin:.1rem 0 0;accent-color:var(--accent);cursor:pointer;
}

/* ---------- login / coupon toggles ---------- */
.also-co-toggles{display:flex;flex-wrap:wrap;gap:.6rem;margin-bottom:1.2rem}
.woocommerce-form-login-toggle .woocommerce-info,
.woocommerce-form-coupon-toggle .woocommerce-info{
  background:var(--acc-blue-pale);border:1px solid var(--acc-blue-soft);
  border-radius:var(--radius-md);padding:.75rem 1rem;margin:0 0 1rem;
  font-size:.92rem;color:var(--acc-ink-deep);
}
.woocommerce-form-login,
.woocommerce-form-coupon{
  background:var(--surface-card);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:clamp(1rem,2vw,1.4rem);margin:0 0 1.2rem;
}

/* ---------- order summary ---------- */
.also-co__sumtoggle{
  display:none;width:100%;align-items:center;gap:.7rem;cursor:pointer;
  background:var(--acc-blue-pale);border:1px solid var(--acc-blue-soft);
  border-radius:var(--radius-lg);padding:.9rem 1.1rem;text-align:left;
  font-family:var(--font-body);color:var(--acc-ink-deep);
}
.also-co__sumhead{display:flex;align-items:baseline;gap:.45rem;flex:1;min-width:0}
.also-co__sumhead > span:first-child{font-weight:700;font-size:1rem}
.also-co__sumcount{font-size:.85rem;color:var(--text-muted)}
.also-co__sumtotal{font-weight:800;font-size:1.05rem}
.also-co__sumchev .also-ic{width:1.1em;height:1.1em;transition:transform var(--dur-fast) var(--ease-out)}
.also-co__sumtoggle[aria-expanded="true"] .also-co__sumchev .also-ic{transform:rotate(180deg)}

.also-co__sumpanel{
  background:var(--surface-card);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:clamp(1rem,2vw,1.4rem);
}
.also-co__aside h2#order_review_heading{margin:0}

.also-co .shop_table{width:100%;border-collapse:collapse;margin:0}
.also-co .shop_table thead{display:none}
.also-co .shop_table td,
.also-co .shop_table th{padding:.6rem 0;text-align:left;vertical-align:top;border:0;font-weight:400}
.also-co .shop_table .product-total,
.also-co .shop_table tfoot td{text-align:right;white-space:nowrap}
.also-co .shop_table tbody tr{border-bottom:1px solid var(--border)}
.also-co .shop_table .product-name{color:var(--text-strong);font-weight:600;line-height:1.35}
.also-co .shop_table .product-quantity{color:var(--text-muted);font-weight:600}
/* the custom Grind / Delivery rows from woocommerce_get_item_data */
.also-co .shop_table .variation{
  margin:.3rem 0 0;font-size:.83rem;color:var(--text-muted);font-weight:400;
  display:grid;grid-template-columns:auto minmax(0,1fr);gap:0 .35rem;
}
.also-co .shop_table .variation dt{font-weight:700;margin:0}
.also-co .shop_table .variation dd{margin:0}
.also-co .shop_table .variation p{margin:0}

.also-co .shop_table tfoot th{font-weight:600;color:var(--text-body);padding-top:.7rem}
.also-co .shop_table tfoot tr.order-total th,
.also-co .shop_table tfoot tr.order-total td{
  font-family:var(--font-display);font-weight:var(--fw-display);font-size:1.25rem;
  color:var(--acc-ink-deep);border-top:1px solid var(--border);padding-top:.9rem;
}
.also-co .shop_table tfoot .cart-discount th,
.also-co .shop_table tfoot .cart-discount td,
.also-co .shop_table tfoot .fee th,
.also-co .shop_table tfoot .fee td{color:var(--success)}
.also-co .shop_table .includes_tax{display:block;font-size:.8rem;color:var(--text-muted)}
.also-co ul#shipping_method{list-style:none;margin:0;padding:0;text-align:right}
.also-co ul#shipping_method li{margin:.15rem 0}
.also-co ul#shipping_method label{display:inline;font-size:.92rem}

/* ---------- payment ---------- */
.also-co__pay .wc_payment_methods{list-style:none;margin:0 0 1rem;padding:0;display:grid;gap:.55rem}
.also-co__pay .wc_payment_method > label{
  display:flex;align-items:center;gap:.6rem;cursor:pointer;
  border:1.5px solid var(--border);border-radius:var(--radius-md);
  padding:.85rem 1rem;font-weight:600;margin:0;
  transition:border-color var(--dur-fast) var(--ease-out);
}
.also-co__pay .wc_payment_method > input{accent-color:var(--accent);width:18px;height:18px;flex:none}
.also-co__pay .wc_payment_method > label:hover{border-color:var(--border-strong)}
.also-co__pay .payment_box{
  background:var(--acc-surface);border-radius:var(--radius-md);
  padding:.9rem 1.1rem;margin:.15rem 0 0;font-size:.92rem;color:var(--text-body);
}
.also-co__pay .payment_box p:last-child{margin-bottom:0}
.also-co__pay .woocommerce-privacy-policy-text{font-size:.85rem;color:var(--text-muted)}
.also-co__pay .validate-required.woocommerce-invalid label{color:var(--error-ink)}

#place_order{width:100%;justify-content:center;min-height:54px;font-size:1.05rem}
.also-co__paytrust{
  display:flex;flex-wrap:wrap;justify-content:center;gap:.4rem 1.1rem;
  list-style:none;margin:.9rem 0 0;padding:0;
}
.also-co__paytrust li{display:inline-flex;align-items:center;gap:.35rem;font-size:.82rem;color:var(--text-muted);font-weight:600}
.also-co__paytrust .also-ic{width:1em;height:1em;color:var(--accent-blue,#93BBCF)}

/* ---------- reflow ---------- */
@media (max-width:899px){
  .also-co__grid{grid-template-columns:minmax(0,1fr)}
  .also-co__main{grid-column:1;grid-row:2}
  .also-co__aside{grid-column:1;grid-row:1;margin-bottom:.4rem}
  .also-co__sticky{position:static}
  /* collapse the summary so the first field stays near the top */
  .also-co__sumtoggle{display:flex}
  .also-co__aside h2#order_review_heading{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .also-co__sumpanel{display:none;margin-top:.5rem}
  .also-co__sumpanel.is-open{display:block}
}
@media (prefers-reduced-motion:reduce){
  .also-co__sumchev .also-ic{transition:none}
}

/* the strip now sits outside #payment; keep it immune if it ever moves back */
.also-co__paytrust{width:100%;flex-basis:100%;clear:both;padding-top:.2rem}

/* ---------- accounts ---------- */
.also-co__prenotes{margin-bottom:1.1rem}
.also-co__prenotes .woocommerce-info{
  background:var(--acc-surface);border:1px solid var(--border);
  border-radius:var(--radius-md);padding:.7rem 1rem;margin:0 0 .5rem;
  font-size:.9rem;color:var(--text-body);
}
.also-co__prenotes .woocommerce-info a{color:var(--accent);font-weight:700}
.also-co__prenotes form.checkout_coupon{
  background:var(--surface-card);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:clamp(1rem,2vw,1.3rem);margin:0 0 .8rem;
}
.also-co__prenotes form.checkout_coupon .form-row{display:inline-block;margin:0 .5rem .5rem 0}

.also-co .woocommerce-account-fields{margin-top:1.2rem}
.also-co .woocommerce-account-fields .create-account{margin-top:.2rem}

.also-acct{
  background:var(--acc-blue-pale);border:1px solid var(--acc-blue-soft);
  border-radius:var(--radius-lg);padding:1rem 1.1rem;margin:.2rem 0 .9rem;
}
.also-acct__head{display:flex;align-items:flex-start;gap:.75rem}
.also-acct__ic{
  display:inline-flex;align-items:center;justify-content:center;flex:none;
  width:38px;height:38px;border-radius:12px;background:#fff;color:var(--accent);
}
.also-acct__ic .also-ic{width:1.15em;height:1.15em}
.also-acct__head strong{display:block;font-size:1rem;color:var(--acc-ink-deep);margin-bottom:.15rem}
.also-acct__head p{margin:0;font-size:.88rem;line-height:1.5;color:var(--text-body)}
.also-acct__perks{
  list-style:none;display:flex;flex-wrap:wrap;gap:.35rem .9rem;
  margin:.7rem 0 0;padding:.7rem 0 0;border-top:1px solid rgba(147,187,207,.45);
}
.also-acct__perks li{display:inline-flex;align-items:center;gap:.3rem;font-size:.8rem;color:var(--text-muted);font-weight:600}
.also-acct__perks .also-ic{width:.95em;height:.95em;color:var(--accent-blue,#93BBCF)}
.also-acct__note{
  display:flex;align-items:center;gap:.4rem;
  margin:.5rem 0 0;font-size:.82rem;color:var(--text-muted);
}
.also-acct__note .also-ic{width:1em;height:1em;color:var(--accent-blue,#93BBCF)}

/* the "save my details" tick, when the account is optional */
.also-co .create-account > .woocommerce-form__label-for-checkbox{
  background:var(--surface-card);border:1.5px solid var(--border);
  border-radius:var(--radius-md);padding:.85rem 1rem;
  transition:border-color var(--dur-fast) var(--ease-out);
}
.also-co .create-account > .woocommerce-form__label-for-checkbox:hover{border-color:var(--border-strong)}
.also-co #createaccount:checked ~ span{color:var(--accent)}

/* password field: core renders its own show/hide button inside the wrapper */
.also-co .woocommerce-password-hint{
  display:block;margin-top:.35rem;font-size:.82rem;color:var(--text-muted);
}
.also-co .password-input{display:block;position:relative}
.also-co .show-password-input{
  position:absolute;right:.75rem;top:50%;transform:translateY(-50%);
  cursor:pointer;background:none;border:0;color:var(--text-muted);
}
.also-co .password-input .input-text{padding-right:2.6rem}

/* login form, now sitting above the billing card */
.also-co .woocommerce-form-login{margin-bottom:1.2rem}
.also-co .woocommerce-form-login .form-row{margin-bottom:.9rem}
.also-co .woocommerce-form-login .woocommerce-form-login__rememberme{font-weight:600}
.also-co .woocommerce-form-login button[type=submit]{margin-right:.6rem}

/* login + coupon are collapsed toggles; core's checkout.js hides the forms
   until the link is clicked, so they must stay outside form.checkout */
.also-co__prenotes{display:flex;flex-direction:column;gap:.5rem}
.also-co__prenotes .woocommerce-form-login-toggle,
.also-co__prenotes .woocommerce-form-coupon-toggle{margin:0}
.also-co__prenotes .woocommerce-info{
  display:flex;align-items:center;gap:.5rem;margin:0;
  background:var(--surface-card);border:1px solid var(--border);
}
.also-co__prenotes .woocommerce-info::before{content:none}
.also-co__prenotes form.woocommerce-form-login{
  background:var(--surface-card);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:clamp(1rem,2vw,1.4rem);margin:.2rem 0 0;
}
.also-co__prenotes form.woocommerce-form-login .form-row{margin-bottom:.9rem}

/* ---------- postcode lookup ---------- */
.also-pc{display:flex;flex-direction:column;gap:.5rem;margin-top:.5rem}
.also-pc__find,
.also-pc__manual{
  align-self:flex-start;font-family:var(--font-body);cursor:pointer;
}
.also-pc__find{
  display:inline-flex;align-items:center;gap:.4rem;
  background:var(--accent);color:var(--acc-cream);border:0;
  border-radius:var(--radius-pill);padding:.6rem 1.1rem;
  font-weight:700;font-size:.92rem;min-height:44px;
  transition:background var(--dur-fast) var(--ease-out),transform var(--dur-fast) var(--ease-out);
}
.also-pc__find:hover{background:var(--acc-primary-hover)}
.also-pc__find:active{transform:scale(var(--press-scale))}
.also-pc__find:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.also-pc__find[disabled]{opacity:.6;cursor:default}
.also-pc__find.is-loading::after{
  content:"";width:14px;height:14px;border-radius:50%;
  border:2px solid rgba(253,244,230,.4);border-top-color:var(--acc-cream);
  animation:also-pc-spin .7s linear infinite;
}
@keyframes also-pc-spin{to{transform:rotate(360deg)}}

.also-pc__manual{
  background:none;border:0;padding:.35rem 0;color:var(--accent);
  font-weight:600;font-size:.88rem;text-decoration:underline;text-underline-offset:2px;
}
.also-pc__manual:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px}
.also-pc__manual[hidden]{display:none}

.also-pc__out:empty{display:none}
.also-pc__msg{margin:0;font-size:.88rem;color:var(--text-muted);line-height:1.5}
.also-pc__count{
  margin:0 0 .4rem;font-size:.78rem;font-weight:700;letter-spacing:.08em;
  text-transform:uppercase;color:var(--text-muted);
}
.also-pc__list{
  list-style:none;margin:0;padding:0;display:grid;gap:.3rem;
  max-height:260px;overflow-y:auto;overscroll-behavior:contain;
  border:1px solid var(--border);border-radius:var(--radius-md);
  background:var(--surface-card);padding:.35rem;
}
.also-pc__pick{
  display:block;width:100%;text-align:left;cursor:pointer;
  background:none;border:0;border-radius:var(--radius-sm);
  padding:.6rem .7rem;font-family:var(--font-body);font-size:.92rem;
  color:var(--text-strong);line-height:1.4;min-height:44px;
  transition:background var(--dur-fast) var(--ease-out);
}
.also-pc__pick:hover{background:var(--acc-blue-pale)}
.also-pc__pick:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.also-pc__sug{
  background:none;border:0;padding:0;cursor:pointer;
  color:var(--accent);font-weight:700;font-family:var(--font-body);
  font-size:inherit;text-decoration:underline;text-underline-offset:2px;
}

/* street fields stay out of the way until there is an address to show */
.also-co .form-row.also-pc-hidden{display:none}
.also-pc__msg:empty{display:none}
.also-pc__manual{min-height:44px;cursor:pointer;text-align:left}
.also-pc__choices{min-width:0;max-width:100%}
.also-pc__choices select{width:100%;text-overflow:ellipsis}
.also-pc__selected{padding:.85rem 1rem;background:var(--acc-blue-pale);border:1px solid var(--acc-blue);border-radius:10px;font-size:.9rem;line-height:1.6}
.also-pc__selected strong{font-size:.75rem;color:var(--text-muted)}
.also-pc__selected p{margin:.25rem 0 0;overflow-wrap:anywhere}

/* ================================================================ *
 * Cart: totals beside the table, not under it
 * ------------------------------------------------------------------
 * WooCommerce stacks the cart form and then .cart-collaterals beneath it,
 * which on a 1440px screen leaves the right-hand two thirds of the page
 * empty and pushes "Proceed to checkout" below the fold.
 *
 * The shortcode's own children are the grid items, so the reassurance
 * block and the notices wrapper are spanned across both columns rather
 * than being pulled into the sidebar.
 * ================================================================ */
@media (min-width:900px){
  .also-cartpage .woocommerce{
    display:grid;
    grid-template-columns:minmax(0,1fr) clamp(300px,26vw,380px);
    gap:clamp(1.4rem,2.6vw,2.4rem);
    align-items:start;
  }
  .also-cartpage .woocommerce > .also-cart-reassure,
  .also-cartpage .woocommerce > .woocommerce-notices-wrapper,
  .also-cartpage .woocommerce > .woocommerce-message,
  .also-cartpage .woocommerce > .woocommerce-info,
  .also-cartpage .woocommerce > .woocommerce-error{grid-column:1 / -1}

  .also-cartpage .woocommerce-cart-form{grid-column:1;min-width:0;margin:0}

  /* Woo floats the totals and gives them 48% by default — both have to go or
     the sidebar sits half-width inside its own column. */
  .also-cartpage .cart-collaterals{
    grid-column:2;width:100%;margin:0;float:none;
    position:sticky;top:96px;   /* clears the ~102px sticky header */
  }
  .also-cartpage .cart-collaterals .cart_totals{width:100%;float:none;margin:0}
  .also-cartpage .cart-collaterals .cross-sells{width:100%;float:none}
}

/* The checkout button is the point of the sidebar — make it read like it. */
.also-cartpage .wc-proceed-to-checkout .checkout-button{width:100%;text-align:center}
